Re: [sqlalchemy] Oracle with sequence for primary key and that sequence out of sync

2014-06-02 Thread Michael Bayer
On Jun 2, 2014, at 1:17 PM, Scott Koranda wrote: > > I investigated and found that the sequence seq_admin_groups_id > was now at the value 68 after having been used previously to > insert rows with IDs in the 500s. > > I stopped the code and used sqlplus to change the sequence > back to a valu

[sqlalchemy] Oracle with sequence for primary key and that sequence out of sync

2014-06-02 Thread Scott Koranda
Hello, I am using SQLAlchemy 0.9.4 with Python 2.6.6 on RHEL 6.5 with Oracle 11.2.0.3. My simple application queries an LDAP directory to find particular records and then reflects the information into an Oracle table. The application is designed to keep the database table version of the informati

Re: [sqlalchemy] column property problem

2014-06-02 Thread Michael Bayer
oh, I should have even seen this in the compiled SQL, sorry. See that :project_id_1 ? that's a bound parameter. It's coming out because when you send the column_property() into the expression like that, it isn't recognized as a SQL-producing object. If OTOH you passed in "JobItem.project_id"

Re: [sqlalchemy] Encapsulating insert/update logic of mapped classes in the class itself

2014-06-02 Thread Alex Grönholm
02.06.2014 16:44, Michael Bayer kirjoitti: the ORM can't persist any value for "delivery_method" unless there is an actual attribute set event. If you are saying session.add(DeliveryAddress()) and flushing, these are the options for "deliveryaddress.delivery_method": 1. the value has no sett

Re: [sqlalchemy] AttributeError: 'psycopg2._psycopg.connection' object has no attribute '_logger'

2014-06-02 Thread Michael Bayer
OK, anyway, the issue is fixed so that particular error (which is very common in PG after an error has occurred) will just be a warning. On Jun 2, 2014, at 8:26 AM, Pau Tallada wrote: > Or this one: > (Pdb) p cursor.close() > *** InternalError: InternalError('current transaction is aborted, co

Re: [sqlalchemy] AttributeError: 'psycopg2._psycopg.connection' object has no attribute '_logger'

2014-06-02 Thread Michael Bayer
I have no idea what that error is. Seems like something local to your application. On Jun 2, 2014, at 8:15 AM, Pau Tallada wrote: > Hi Michael, > > It did not happen every time. I'm pretty sure with 0.8.x it did not happen. > > show standard_conforming_strings --> on > > About the Excepti

Re: [sqlalchemy] Encapsulating insert/update logic of mapped classes in the class itself

2014-06-02 Thread Michael Bayer
the ORM can't persist any value for "delivery_method" unless there is an actual attribute set event. If you are saying session.add(DeliveryAddress()) and flushing, these are the options for "deliveryaddress.delivery_method": 1. the value has no setting and is not present in the INSERT statement

Re: [sqlalchemy] AttributeError: 'psycopg2._psycopg.connection' object has no attribute '_logger'

2014-06-02 Thread Pau Tallada
Or this one: (Pdb) p cursor.close() *** InternalError: InternalError('current transaction is aborted, commands ignored until end of transaction block\n',) 2014-06-02 14:15 GMT+02:00 Pau Tallada : > Hi Michael, > > It did not happen every time. I'm pretty sure with 0.8.x it did not happen. > > s

Re: [sqlalchemy] AttributeError: 'psycopg2._psycopg.connection' object has no attribute '_logger'

2014-06-02 Thread Pau Tallada
Hi Michael, It did not happen every time. I'm pretty sure with 0.8.x it did not happen. show standard_conforming_strings --> on About the Exception... Could it be this one?: AttributeError("'module' object has no attribute 'ps2'",) Thank you very much! Pau. 2014-05-30 22:26 GMT+02:00 Michae

Re: [sqlalchemy] Encapsulating insert/update logic of mapped classes in the class itself

2014-06-02 Thread Alex Grönholm
That's the first thing I tried, but validators don't get called unless you explicitly set a value to the column. So for something like session.add(DeliveryAddress()), the validator doesn't get called. maanantai, 2. kesäkuuta 2014 14.27.47 UTC+3 Michael Bayer kirjoitti: > > > On Jun 2, 2014, at

Re: [sqlalchemy] Encapsulating insert/update logic of mapped classes in the class itself

2014-06-02 Thread Michael Bayer
On Jun 2, 2014, at 1:47 AM, Alex Grönholm wrote: > This has been a problem for me for years. > > class DeliveryAddress(Base, Address): > ... > delivery_method = Column(String) > ... > > @event.listens_for(DeliveryAddress, 'before_insert') > def before_insert_deliveryaddress(mapper,

Re: [sqlalchemy] column property problem

2014-06-02 Thread Vladimir Iliev
sorry, i have copy-and-paste incomplete parts of my real model definitions. run the attached file and you will see the exception sqlalchemy.exc.InterfaceError: (InterfaceError) Error binding parameter 0 - probably unsupported type. u'SELECT (SELECT sum(nestingsheetlayoutitem.quantity) AS su