From: Ants Aasma Date: Sat, 14 Jul 2007 12:53:18 +0000 (+0000) Subject: rearrange sqlite dialect initialization to be able to warn about pysqlite1 being... X-Git-Tag: rel_0_3_9~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=448b3a22bedd02f9605b542940de26aa796ae564;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git rearrange sqlite dialect initialization to be able to warn about pysqlite1 being too old. fixes #654 --- diff --git a/CHANGES b/CHANGES index 94a925cae6..0a1990ea1b 100644 --- a/CHANGES +++ b/CHANGES @@ -107,6 +107,8 @@ - the fix in "schema" above fixes reflection of foreign keys from an alt-schema table to a public schema table - sqlite + - rearranged dialect initialization so it has time to warn about pysqlite1 + being too old. - sqlite better handles datetime/date/time objects mixed and matched with various Date/Time/DateTime columns - string PK column inserts dont get overwritten with OID [ticket:603] diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py index 8e776fb26e..b42468c7a4 100644 --- a/lib/sqlalchemy/databases/sqlite.py +++ b/lib/sqlalchemy/databases/sqlite.py @@ -159,13 +159,13 @@ class SQLiteDialect(ansisql.ANSIDialect): ansisql.ANSIDialect.__init__(self, default_paramstyle='qmark', **kwargs) def vers(num): return tuple([int(x) for x in num.split('.')]) - self.supports_cast = (self.dbapi is None or vers(self.dbapi.sqlite_version) >= vers("3.2.3")) if self.dbapi is not None: sqlite_ver = self.dbapi.version_info if sqlite_ver < (2,1,'3'): warnings.warn(RuntimeWarning("The installed version of pysqlite2 (%s) is out-dated, and will cause errors in some cases. Version 2.1.3 or greater is recommended." % '.'.join([str(subver) for subver in sqlite_ver]))) if vers(self.dbapi.sqlite_version) < vers("3.3.13"): warnings.warn(RuntimeWarning("The installed version of sqlite (%s) is out-dated, and will cause errors in some cases. Version 3.3.13 or greater is recommended." % self.dbapi.sqlite_version)) + self.supports_cast = (self.dbapi is None or vers(self.dbapi.sqlite_version) >= vers("3.2.3")) def dbapi(cls): try: