diff options
author | Federico Caselli <cfederico87@gmail.com> | 2020-08-07 22:38:24 +0200 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2020-08-18 22:03:28 +0000 |
commit | 8e01a928d9559014413d08855c187b563c35ae72 (patch) | |
tree | b3ba77209c098aa5da8cd18cb95a64c85f5198f0 /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | 0901190bb440580f0664fe3f6310173762b908e0 (diff) | |
download | sqlalchemy-8e01a928d9559014413d08855c187b563c35ae72.tar.gz |
Support data types for CREATE SEQUENCE in PostgreSQL
Allow specifying the data type when creating a :class:`.Sequence` in
PostgreSQL by using the parameter :paramref:`.Sequence.data_type`.
Fixes: #5498
Change-Id: I2b4a80aa89b1503c56748dc3ecd2cf145faddd8b
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 7717a2526..92e48f1f3 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -2184,6 +2184,17 @@ class PGDDLCompiler(compiler.DDLCompiler): generated.sqltext, include_table=False, literal_binds=True ) + def visit_create_sequence(self, create, **kw): + prefix = None + if create.element.data_type is not None: + prefix = " AS %s" % self.type_compiler.process( + create.element.data_type + ) + + return super(PGDDLCompiler, self).visit_create_sequence( + create, prefix=prefix, **kw + ) + class PGTypeCompiler(compiler.GenericTypeCompiler): def visit_TSVECTOR(self, type_, **kw): |