Gerhard Häring posted this on gmane.comp.python.sqlalchemy.user: >> On 7/10/06, *Michael Bayer* < [EMAIL PROTECTED] >> <mailto:[EMAIL PROTECTED]>> wrote: >> >> I can add a switch into sqlite.py to not produce a CAST clause >> based on the version of sqlite being used. does anyone know >> offhand how to get sqlite's version from the pysqlite API ? > > Jonathan Ellis wrote: >> >>> from pysqlite2 import dbapi2 >> >>> dbapi2.sqlite_version >> '3.3.4' > > sqlite_version_info is even better, because you can then do a simple > compare like > sqlite_version_info >= (3, 2, 3) > -- Gerhard
But pysqlite 1.* does not have this parameter and sqlalchemy fails with an exception. Here is a quick-and-dirty patch in order to avoid this issue. Note that the patch uses the pysqlite module version (the only data available) and so the cast is not done in the module. With this patch (against r1700) sqlalchemy passes the same amount of tests that the r1696 version (which doesn't have the version check), at least in my system (pysqlite 1.1.7, windows). ----------------------------------------------------------------------- Index: sqlite.py =================================================================== --- sqlite.py (revisi¢n: 1700) +++ sqlite.py (copia de trabajo) @@ -129,7 +129,11 @@ def __init__(self, **kwargs): def vers(num): return tuple([int(x) for x in num.split('.')]) - self.supports_cast = (vers(sqlite.sqlite_version) >= vers ("3.2.3")) + try: + sqlite_version = sqlite.sqlite_version + except AttributeError: + sqlite_version = sqlite.version + self.supports_cast = (vers(sqlite_version) >= vers("3.2.3")) ansisql.ANSIDialect.__init__(self, **kwargs) def compiler(self, statement, bindparams, **kwargs): return SQLiteCompiler(self, statement, bindparams, **kwargs) ----------------------------------------------------------------------- Regards, Raul Garcia.
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users