diff options
author | Malik Diarra <malik.diarra@gmail.com> | 2014-08-13 01:39:09 +0200 |
---|---|---|
committer | Malik Diarra <malik.diarra@gmail.com> | 2014-08-17 01:56:02 +0200 |
commit | ef6042ff461e490c2a3040f18f0a3688b2e601a0 (patch) | |
tree | 679d9cb74b7d391cbf85fdb6ee60ac5a65b674a4 /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | b577afcb2bdcd94581606bc911968d8885509769 (diff) | |
download | sqlalchemy-ef6042ff461e490c2a3040f18f0a3688b2e601a0.tar.gz |
Adding a tablespace options for postgresql create table
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index c2b1d66f4..0f008642e 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1448,6 +1448,13 @@ class PGDDLCompiler(compiler.DDLCompiler): text += self.define_constraint_deferrability(constraint) return text + def post_create_table(self, table): + table_opts = [] + if table.dialect_options['postgresql']['tablespace']: + table_opts.append('TABLESPACE %s' % table.dialect_options['postgresql']['tablespace']) + + return ' '.join(table_opts) + class PGTypeCompiler(compiler.GenericTypeCompiler): @@ -1707,7 +1714,8 @@ class PGDialect(default.DefaultDialect): "ops": {} }), (schema.Table, { - "ignore_search_path": False + "ignore_search_path": False, + "tablespace": None }) ] |