summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/postgres.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-08-26 19:46:33 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-08-26 19:46:33 +0000
commit2d4dfb959b07d3641ac5565c9f4fa57fe1267097 (patch)
treeaeffbce865910d99490e2672e6c8407c80a71d29 /lib/sqlalchemy/databases/postgres.py
parent5b8ab3e8abc704ee10ece0d4d3e93bf9164a9826 (diff)
downloadsqlalchemy-2d4dfb959b07d3641ac5565c9f4fa57fe1267097.tar.gz
- added "timezone=True" flag to DateTime and Time types. postgres
so far will convert this to "TIME[STAMP] (WITH|WITHOUT) TIME ZONE", so that control over timezone presence is more controllable (psycopg2 returns datetimes with tzinfo's if available, which can create confusion against datetimes that dont). [ticket:275]
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r--lib/sqlalchemy/databases/postgres.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index 1bcf83409..19ec95a13 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -46,7 +46,7 @@ class PGSmallInteger(sqltypes.Smallinteger):
return "SMALLINT"
class PG2DateTime(sqltypes.DateTime):
def get_col_spec(self):
- return "TIMESTAMP"
+ return "TIMESTAMP " + (self.timezone and "WITH" or "WITHOUT") + " TIME ZONE"
class PG1DateTime(sqltypes.DateTime):
def convert_bind_param(self, value, dialect):
if value is not None:
@@ -70,7 +70,7 @@ class PG1DateTime(sqltypes.DateTime):
value.hour, value.minute, seconds,
microseconds)
def get_col_spec(self):
- return "TIMESTAMP"
+ return "TIMESTAMP " + (self.timezone and "WITH" or "WITHOUT") + " TIME ZONE"
class PG2Date(sqltypes.Date):
def get_col_spec(self):
return "DATE"
@@ -89,7 +89,7 @@ class PG1Date(sqltypes.Date):
return "DATE"
class PG2Time(sqltypes.Time):
def get_col_spec(self):
- return "TIME"
+ return "TIME " + (self.timezone and "WITH" or "WITHOUT") + " TIME ZONE"
class PG1Time(sqltypes.Time):
def convert_bind_param(self, value, dialect):
# TODO: perform appropriate postgres1 conversion between Python DateTime/MXDateTime
@@ -102,7 +102,7 @@ class PG1Time(sqltypes.Time):
# TODO: perform appropriate postgres1 conversion between Python DateTime/MXDateTime
return value
def get_col_spec(self):
- return "TIME"
+ return "TIME " + (self.timezone and "WITH" or "WITHOUT") + " TIME ZONE"
class PGText(sqltypes.TEXT):
def get_col_spec(self):