summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-11-03 18:33:57 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-11-03 18:33:57 +0000
commite35dcee6ca9c12e5e78702ae7679796cbe8365f2 (patch)
tree7b9164469aa55b98206e90336832b179113bd734 /lib/sqlalchemy/sql
parent56f64add8195f35961f67cf1baebda476dfb03ec (diff)
downloadsqlalchemy-e35dcee6ca9c12e5e78702ae7679796cbe8365f2.tar.gz
- The "start" and "increment" attributes on Sequence now
generate "START WITH" and "INCREMENT BY" by default, on Oracle and Postgresql. Firebird doesn't support these keywords right now. [ticket:1545]
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/compiler.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 088ca1969..6802bfbef 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1024,7 +1024,18 @@ class DDLCompiler(engine.Compiled):
self.preparer.format_table(create.element.table),
self.process(create.element)
)
+
+ def visit_create_sequence(self, create):
+ text = "CREATE SEQUENCE %s" % self.preparer.format_sequence(create.element)
+ if create.element.increment is not None:
+ text += " INCREMENT BY %d" % create.element.increment
+ if create.element.start is not None:
+ text += " START WITH %d" % create.element.start
+ return text
+ def visit_drop_sequence(self, drop):
+ return "DROP SEQUENCE %s" % self.preparer.format_sequence(drop.element)
+
def visit_drop_constraint(self, drop):
preparer = self.preparer
return "ALTER TABLE %s DROP CONSTRAINT %s%s" % (