Hello list,
I am a newbie to sqlalchemy and have been playing around with it in a
windows environment w/ mssql.
I keep getting this error after I do an insert. The insert is
successful, but I think there is a problem in getting the pk
afterward.
Thank you very much,
Jin Lee
>>> import pyodbc as pyodbc
>>> metadata = create_engine('mssql://user:[EMAIL PROTECTED]/quickwiki_test',
module=pyodbc)
>>> users = Table('users', metadata, autoload=True)
>>> i = users.insert()
>>> print i
INSERT INTO users (user_id, user_name, password) VALUES (?, ?, ?)
>>> metadata.engine.echo=True
>>> i.execute(user_name='testuser', password='secret')
2007-05-23 15:52:14,999 INFO sqlalchemy.engine.base.Engine.0x..90 SET nocount ON
2007-05-23 15:52:15,015 INFO sqlalchemy.engine.base.Engine.0x..90 None
2007-05-23 15:52:15,015 INFO sqlalchemy.engine.base.Engine.0x..90
INSERT INTO users (user_name, password) VALUES (?, ?)
2007-05-23 15:52:15,015 INFO sqlalchemy.engine.base.Engine.0x..90
['testuser', 'secret']
2007-05-23 15:52:15,030 INFO sqlalchemy.engine.base.Engine.0x..90 COMMIT
Traceback (most recent call last):
File "<pyshell#71>", line 1, in <module>
i.execute(user_name='testuser', password='secret')
File "build\bdist.win32\egg\sqlalchemy\sql.py", line 1102, in execute
return self.compile(engine=self.engine,
parameters=compile_params).execute(*multiparams, **params)
File "build\bdist.win32\egg\sqlalchemy\sql.py", line 994, in execute
return e.execute_compiled(self, *multiparams, **params)
File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 772, in
execute_compiled
return connection.execute_compiled(compiled, *multiparams, **params)
File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 561, in
execute_compiled
context.post_exec()
File "build\bdist.win32\egg\sqlalchemy\databases\mssql.py", line
264, in post_exec
self._last_inserted_ids = [int(row[0])]
TypeError: int() argument must be a string or a number, not 'NoneType'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---