Re: [sqlalchemy] How to insert a new row into a Sybase database table which has an IDENTITY primary key column?

2012-05-10 Thread Michael Bayer
On May 10, 2012, at 3:39 AM, Anthony Kong wrote: > I think I have found the root cause of the problem. > > I am using a sybase database server of version 15 ("Adaptive Server > Enterprise/15.0.3/EBF 17163") > > But for various reasons we are still using sybase ODBC driver 12.5. > > If I sw

Re: [sqlalchemy] How to insert a new row into a Sybase database table which has an IDENTITY primary key column?

2012-05-09 Thread Anthony Kong
I think I have found the root cause of the problem. I am using a sybase database server of version 15 ("Adaptive Server Enterprise/15.0.3/EBF 17163") But for various reasons we are still using sybase ODBC driver 12.5. If I switch to 15.5, it just works as expected. *A follow-up question**

Re: [sqlalchemy] How to insert a new row into a Sybase database table which has an IDENTITY primary key column?

2012-05-09 Thread Anthony Kong
1) Yes, I am working with existing table 2) The id column is not included in the SQL, which is the expected behaviour if we want the server to generate value for the IDENTITY column in sybase/ms-sql 3) ok Any tracing option I can use to see how SQLA deals with the 'id' column? On Thursday,

Re: [sqlalchemy] How to insert a new row into a Sybase database table which has an IDENTITY primary key column?

2012-05-09 Thread Michael Bayer
On May 9, 2012, at 4:46 PM, Anthony Kong wrote: > > Hi, Micheal, > > Thanks for the reply. I have added autoincrement to the Column definition of > 'id', like so: > > id = Column(Integer, name='id_trade', primary_key=True, autoincrement=True) that's fine, but the table has to be created tha

Re: [sqlalchemy] How to insert a new row into a Sybase database table which has an IDENTITY primary key column?

2012-05-09 Thread Anthony Kong
Hi, Micheal, Thanks for the reply. I have added autoincrement to the Column definition of 'id', like so: id = Column(Integer, name='id_trade', primary_key=True, autoincrement=True) In the log I can see the id column is not included in the INSERT statement. I have taken that SQL statement out

Re: [sqlalchemy] How to insert a new row into a Sybase database table which has an IDENTITY primary key column?

2012-05-09 Thread Michael Bayer
the TRADE table needs the "id" column to be an IDENTITY column, otherwise you have to populate Trade.id with an explicit value. background on IDENTITY: http://infocenter.sybase.com/archive/index.jsp?topic=/com.sybase.infocenter.dc00170.1260/html/iqapg/iqapg491.htm Also its very likely you want