SqlAlchemy&Pymssql and Insert TimeStamp

Feb 21, 2012
Reaction score
i am using sqlalchemy 7.5 pymmsql 2.0.0b.

When I try to insert data in table with a Timestamp column, i get this error :

File "pymssql.pyx", line 384, in pymssql.Cursor.execute (pymssql.c:4289)
sqlalchemy.exc.OperationalError: (OperationalError) (273, 'Cannot insert an explicit value into a timestamp column.
Use INSERT with a column list to exclude the timesampt column, or insert a DEFAULT into the timestamp column.DB-LIB error message 273, severity16
General SQL Server error: Check messages from the SQL Server)
"INSERT INTO film_cat(film_id,category_id,last_update) VALUES (%(film_id)s,%(category_id)s,%(last_update)s)'
{'catgory_id': 6, 'film_id': 1, 'last_update': datetime:datime(2006,2,15,5,7,9) }))"'

However the result shows for example
(datetime.datetime(2006, 2, 16, 17, 50, 19) which is supposed to be
2006-02-16 17:50:19.000
anyway to correct query a date column using pymssql so that it gives
the correct date format? thanks


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question