summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/postgres.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2009-03-30 20:41:48 +0000
committerJason Kirtland <jek@discorporate.us>2009-03-30 20:41:48 +0000
commitaca84bebb091a51ceeb911249c366e17b954826a (patch)
tree87a0424805905c9fdae0ab6930144c91b9a78ff6 /lib/sqlalchemy/databases/postgres.py
parent1ad157a0a1823706ffb43ee7d235c38ae16f46ff (diff)
downloadsqlalchemy-aca84bebb091a51ceeb911249c366e17b954826a.tar.gz
extract() is now dialect-sensitive and supports SQLite and others.
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r--lib/sqlalchemy/databases/postgres.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py
index 038a9e8df..068afaf3d 100644
--- a/lib/sqlalchemy/databases/postgres.py
+++ b/lib/sqlalchemy/databases/postgres.py
@@ -792,6 +792,12 @@ class PGCompiler(compiler.DefaultCompiler):
else:
return text
+ def visit_extract(self, extract, **kwargs):
+ field = self.extract_map.get(extract.field, extract.field)
+ return "EXTRACT(%s FROM %s::timestamp)" % (
+ field, self.process(extract.expr))
+
+
class PGSchemaGenerator(compiler.SchemaGenerator):
def get_column_specification(self, column, **kwargs):
colspec = self.preparer.format_column(column)