[sqlalchemy] isolation level not supported on MySQL 3.23

2012-09-17 Thread Ids
We were using SQLAlchemy 0.5.1 and wanted to upgrade to 0.7.8 but ran into 
the following problem.
When trying to create an engine, the mysql dialect tries to determine the 
current isolation level by issuing the SELECT @@tx_isolation; SQL statement 
(from dialects/mysql/base.py get_isolation_level()). However, this 
statement is not supported on MySQL 3.23 and therefore SQLAlchemy 0.7.8 
doesn't seem to work anymore.

We worked around this by not using SQLAlchemy anymore for our antique MySQL 
3.23 db, but this means you could also delete 3.23 from the supported 
database list. As a solution you could maybe add a try/except clause around 
it with a version check just like you do in do_commit() in 
dialects/mysql/base.py

Best regards,
Ids

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/uJQPXujgUCEJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] isolation level not supported on MySQL 3.23

2012-09-17 Thread Michael Bayer

On Sep 17, 2012, at 7:21 AM, Ids wrote:

 We were using SQLAlchemy 0.5.1 and wanted to upgrade to 0.7.8 but ran into 
 the following problem.
 When trying to create an engine, the mysql dialect tries to determine the 
 current isolation level by issuing the SELECT @@tx_isolation; SQL statement 
 (from dialects/mysql/base.py get_isolation_level()). However, this statement 
 is not supported on MySQL 3.23 and therefore SQLAlchemy 0.7.8 doesn't seem to 
 work anymore.
 
 We worked around this by not using SQLAlchemy anymore for our antique MySQL 
 3.23 db, but this means you could also delete 3.23 from the supported 
 database list. As a solution you could maybe add a try/except clause around 
 it with a version check just like you do in do_commit() in 
 dialects/mysql/base.py

can you let me know the specific point version of MySQL, I notice we have 
several transaction-related directives that are disabled for versions  
3.23.15..15 seems to be the first version that supports COMMIT and 
ROLLBACK.

Here's a simple patch you can try:

diff -r c72dc70dba37 lib/sqlalchemy/dialects/mysql/base.py
--- a/lib/sqlalchemy/dialects/mysql/base.py Sun Sep 16 21:15:55 2012 -0400
+++ b/lib/sqlalchemy/dialects/mysql/base.py Mon Sep 17 08:57:51 2012 -0400
@@ -1872,6 +1872,8 @@
 cursor.close()
 
 def get_isolation_level(self, connection):
+if self.server_version_info  (3, 23, 15):
+raise NotImplementedError()
 cursor = connection.cursor()
 cursor.execute('SELECT @@tx_isolation')
 val = cursor.fetchone()[0]



 
 Best regards,
 Ids
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To view this discussion on the web visit 
 https://groups.google.com/d/msg/sqlalchemy/-/uJQPXujgUCEJ.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.