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 that way in the database also, 
that is, using the IDENTITY keyword explicitly.  if you are dealing with an 
existing database, that may not be the case.


> 
> In the log I can see the id column is not included in the INSERT statement. I 
> have taken that SQL statement out and run it, and a row can be successfully 
> created in the table.

that's also fine but is there a value for the primary key column ? or is it 
NULL?


> 
> Do I need to do anything related to reload? I suspect may be the row cannot 
> be inserted after all but sqlalchemy does not retrieve @@IDENTITY?

the work SQLA does with @@IDENTITY may not be present in the log output of 
SQLAlchemy itself.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to