summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/postgres.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2005-10-23 06:25:43 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2005-10-23 06:25:43 +0000
commit4875c3702c3d59072a3d074f4c3c384ebd6ffa9b (patch)
tree07b3fcc777ce65a2ba0e02770c5fe9979a3a1a1c /lib/sqlalchemy/databases/postgres.py
parent722f97a826944073089998c42c48371a2514b9d6 (diff)
downloadsqlalchemy-4875c3702c3d59072a3d074f4c3c384ebd6ffa9b.tar.gz
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r--lib/sqlalchemy/databases/postgres.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index 1d0349a07..547a2c0b7 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -26,8 +26,11 @@ from sqlalchemy.ansisql import *
try:
import psycopg2 as psycopg
except:
- import psycopg
-
+ try:
+ import psycopg
+ except:
+ psycopg = None
+
class PGNumeric(sqltypes.Numeric):
def get_col_spec(self):
return "NUMERIC(%(precision)s, %(length)s)" % {'precision': self.precision, 'length' : self.length}
@@ -70,8 +73,9 @@ def engine(opts, **params):
class PGSQLEngine(ansisql.ANSISQLEngine):
def __init__(self, opts, module = None, **params):
if module is None:
- self.module = __import__('psycopg2')
- #self.module = psycopg
+ if psycopg is None:
+ raise "Couldnt locate psycopg1 or psycopg2: specify postgres module argument"
+ self.module = psycopg
else:
self.module = module
self.opts = opts or {}