[sqlalchemy] MSSQL Bulk Insert issues

2015-06-04 Thread Sylvester Steele
Hi Guys, We use SQLAlchemy (version 0.7.6) only to get the raw cursor, then use that to execute queries. I just ran into the following issue with BULK INSERT statements: I have a table with 4 columns which has a primary key constraint. If the primary key constraint is violated, I get an

Re: [sqlalchemy] Concurrent raw sql execution in a multi-threaded application: Connection is busy with results for another hstmt error

2014-05-14 Thread Sylvester Steele
Correct, that is what I did. Except, I do a conn.close() at the end rather than a del. On Tue, May 13, 2014 at 4:10 PM, Michael Bayer mike...@zzzcomputing.comwrote: On May 13, 2014, at 2:23 PM, Sylvester Steele sylvesterste...@gmail.com wrote: ODBC connection pooling setting did

Re: [sqlalchemy] Concurrent raw sql execution in a multi-threaded application: Connection is busy with results for another hstmt error

2014-05-13 Thread Sylvester Steele
On Mon, May 12, 2014 at 6:02 PM, Sylvester Steele sylvesterste...@gmail.com wrote: On Mon, May 12, 2014 at 4:53 PM, Michael Bayer mike...@zzzcomputing.comwrote: On May 12, 2014, at 2:30 PM, Sylvester Steele sylvesterste...@gmail.com wrote: the code here isn’t really showing me

Re: [sqlalchemy] Concurrent raw sql execution in a multi-threaded application: Connection is busy with results for another hstmt error

2014-05-12 Thread Sylvester Steele
the code here isn’t really showing me the nature of the two separate connections. They will be different unless you’re using “threadlocal” on the engine or pool and both are in the same thread. A simple comparison of the “raw” DBAPI connections to see if they are different objects will

Re: [sqlalchemy] Concurrent raw sql execution in a multi-threaded application: Connection is busy with results for another hstmt error

2014-05-12 Thread Sylvester Steele
On Mon, May 12, 2014 at 4:53 PM, Michael Bayer mike...@zzzcomputing.comwrote: On May 12, 2014, at 2:30 PM, Sylvester Steele sylvesterste...@gmail.com wrote: the code here isn’t really showing me the nature of the two separate connections. They will be different unless you’re using

[sqlalchemy] Concurrent raw sql execution in a multi-threaded application: Connection is busy with results for another hstmt error

2014-05-09 Thread Sylvester Steele
Hi, I am using sqlalchemy version 0.7.6 on Win 7. I am using sqlalchemy to execute raw SQL queries in parallel. Here is how I do it: eng = get_engine() #Threadsafe method to get engine raw_con = eng.connect().connection.connection raw_con.autocommit= True crsr = raw_con.cursor() res =

Re: [sqlalchemy] SQLAlchemy not executing query

2014-01-10 Thread Sylvester Steele
the “autocommit” option: conn = engine.connect() conn.execution_options(autocommit=True).execute(“your sql”) On Jan 9, 2014, at 6:39 PM, Sylvester Steele sylvesterste...@gmail.com wrote: Hi, I am using SQLAlchemy version 0.7.6 with pyodbc to connect to MSSQL 2012. Currently I am using

[sqlalchemy] Custom logic for query execution

2014-01-10 Thread Sylvester Steele
Hi, Currently I am using the sqlalchemy engine to execute string queries only. I do plan on using sqlalchemy more extensively (including ORM) in the near future. I need to add retry logic on every query, in case of some database failures (less than ideal, but the server is a bit flaky).

Re: [sqlalchemy] Custom logic for query execution

2014-01-10 Thread Sylvester Steele
Thanks for you feedback. I will take a look at the pessimistic listener On Fri, Jan 10, 2014 at 2:02 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 10, 2014, at 1:50 PM, Sylvester Steele sylvesterste...@gmail.com wrote: Hi, Currently I am using the sqlalchemy engine to execute

[sqlalchemy] SQLAlchemy not executing query

2014-01-09 Thread Sylvester Steele
Hi, I am using SQLAlchemy version 0.7.6 with pyodbc to connect to MSSQL 2012. Currently I am using SQLAlchemy only for its connection pooling etc. So, at the moment I only use the engine.execute function to execute string queries. Weirdly, the following query seems to have no effect at