mssql and pyodbc weirdness with data not saving

63 views
Skip to first unread message

Randy Syring

unread,
May 29, 2009, 2:37:12 AM5/29/09
to sqlalchemy
I have been having a weird thing happen when using pyodbc with mssql.
The create table statements work, but none of the INSERT statements
do. For example, when I run code and echo, I get this:

(TCSData) F:\Inetpub\TCSData\src\tcsdata-dist\tcsdata>pysmvt broadcast
initapp
calling: action_pysapp_initapp
2009-05-29 02:22:17,194 INFO sqlalchemy.engine.base.Engine.0x...a350
BEGIN
2009-05-29 02:22:17,210 INFO sqlalchemy.engine.base.Engine.0x...a350
INSERT INTO
users_permission (name) VALUES (?); select scope_identity()
2009-05-29 02:22:17,210 INFO sqlalchemy.engine.base.Engine.0x...a350
[u'webapp-c
ontrolpanel']
2009-05-29 02:22:17,210 INFO sqlalchemy.engine.base.Engine.0x...a350
COMMIT

But there is nothing in that table when I am done committing. I
profiled the server, and here is the code sequence that it shows:

set implicit_transactions on
exec sp_datatype_info 93, @ODBCVer = 3
SET IMPLICIT_TRANSACTIONS OFF
BEGIN TRANSACTION
declare @P1 int
set @P1=1
exec sp_prepexec @P1 output, N'@P1 nvarchar(19)', N'INSERT INTO
users_permission (name) VALUES (@P1); select scope_identity()',
N'webapp-controlpanel'
select @P1
exec sp_unprepare 1
IF @@TRANCOUNT > 0 COMMIT TRAN

If is switch to adodbapi, then the insert works just fine.

mtrier

unread,
Jun 1, 2009, 3:55:23 PM6/1/09
to sqlalchemy
Hi,
Looks like you're using 0.5.3 I believe which had problems with this.
Upgrade to a later release.

Thanks,

Michael

Randy Syring

unread,
Jun 1, 2009, 4:04:53 PM6/1/09
to sqlalchemy
Darn! I thought I checked that. But you are right. Thank you for
the post!
Reply all
Reply to author
Forward
0 new messages