diff options
author | Robert Leftwich <rtl@pobox.com> | 2006-01-10 00:49:47 +0000 |
---|---|---|
committer | Robert Leftwich <rtl@pobox.com> | 2006-01-10 00:49:47 +0000 |
commit | 060b8f0478710e9891e73f8832d1883ae0ad999b (patch) | |
tree | af7d397bf8666973520e69a3813be0c755b300d5 /lib/sqlalchemy/databases/postgres.py | |
parent | 4f50c6d6b6bb879f8ed52959daf74fe59203612c (diff) | |
download | sqlalchemy-060b8f0478710e9891e73f8832d1883ae0ad999b.tar.gz |
r810@lightspeed: robert | 2006-01-10 11:49:18 +1100
Added check for __version__ to determine if pyscopg is v1 or v2
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r-- | lib/sqlalchemy/databases/postgres.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 7cfcb8382..6b1dbef46 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -118,10 +118,16 @@ class PGSQLEngine(ansisql.ANSISQLEngine): else: self.module = module # figure psycopg version 1 or 2 - if self.module.__name__.endswith('psycopg2'): - self.version = 2 - else: - self.version = 1 + try: + if self.module.__version__.startswith('2'): + self.version = 2 + else: + self.version = 1 + except: + if self.module.__name__.endswith('psycopg2'): + self.version = 2 + else: + self.version = 1 self.opts = opts or {} ansisql.ANSISQLEngine.__init__(self, **params) |