SqlAlchemy hangs after adding record in MS SQL

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-05-20T21:16:06Z Indexed on 2010/05/20 21:20 UTC
Read the original article Hit count: 164

Filed under:
|
|

I'm running SQLAlchemy on Jython and trying to connect to a MS SQL database using jTDS with windows authentication. I can query and delete just fine but when I try to insert new values it will hang when I commit.

int 'before add'
session.add(newVal)
print 'after add'
session.commit()
print 'after commit'

I see the first two print statements but not the last. My CPU maxes out and I can't even query the table directly using the MS SQL Management Studio. When I kill the Jython java process I can query again but the new values haven't been added.

Strangely enough I can insert values directly using an SQL command:

insert_sql = "INSERT INTO my_table (my_value) VALUES ('test_value')"
session.execute(insert_sql)
session.commit()

Any ideas what I'm doing wrong?

© Stack Overflow or respective owner

Related posts about python

Related posts about jython