summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/postgres.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-01-03 00:32:39 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-01-03 00:32:39 +0000
commitc152cb32b38a25d3c6c5d13922d0e2a2192411f5 (patch)
treef04ec2a373d5ca10d5a7cae7181b16f4fa76ce1c /lib/sqlalchemy/databases/postgres.py
parent8d7c9349b2ad717969de3e8463f75c68d7af4ff1 (diff)
downloadsqlalchemy-c152cb32b38a25d3c6c5d13922d0e2a2192411f5.tar.gz
trying to get pg1 date type to work, unsuccessful
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r--lib/sqlalchemy/databases/postgres.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index 350f61b75..a67210402 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -16,12 +16,14 @@ import sqlalchemy.databases.information_schema as ischema
try:
import psycopg2 as psycopg
+ #import psycopg2.psycopg1 as psycopg
except:
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}
@@ -35,10 +37,11 @@ class PG2DateTime(sqltypes.DateTime):
def get_col_spec(self):
return "TIMESTAMP"
class PG1DateTime(sqltypes.DateTime):
- def convert_bind_param(self, value):
+ def convert_bind_param(self, value, engine):
# TODO: perform appropriate postgres1 conversion between Python DateTime/MXDateTime
- return value
- def convert_result_value(self, value):
+ # this one doesnt seem to work with the "emulation" mode
+ return psycopg.TimestampFromMx(value)
+ def convert_result_value(self, value, engine):
# TODO: perform appropriate postgres1 conversion between Python DateTime/MXDateTime
return value
def get_col_spec(self):
@@ -115,7 +118,7 @@ class PGSQLEngine(ansisql.ANSISQLEngine):
else:
self.module = module
# figure psycopg version 1 or 2
- if self.module.__name__ == 'psycopg2':
+ if self.module.__name__.endswith('psycopg2'):
self.version = 2
else:
self.version = 1