diff options
author | Vsevolod Solovyov <vsevolod.solovyov@gmail.com> | 2018-03-15 09:00:47 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-03-30 12:18:09 -0400 |
commit | 0174d698a8ed155b51cc44c503b10bc67b16dfc9 (patch) | |
tree | 22d4870e735e032e9c258dddf2d0d54c23002bbe /test/dialect/postgresql/test_compiler.py | |
parent | 0fd508ad32a6f94653757a5ae10c1eae14e099fc (diff) | |
download | sqlalchemy-0174d698a8ed155b51cc44c503b10bc67b16dfc9.tar.gz |
Add support for declarative partitioning in PostgreSQL 10
Added support for "PARTITION BY" in Postgresql table definitions,
using "postgresql_partition_by". Pull request courtesy
Vsevolod Solovyov.
Change-Id: Id74d6882d7193fae1e5fd44b6e12d6852866fcc4
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/430
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r-- | test/dialect/postgresql/test_compiler.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py index db142a657..66764fcc2 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -233,6 +233,26 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): 'CREATE TABLE atable (id INTEGER) INHERITS ' '( "Quote Me", "quote Me Too" )') + def test_create_table_partition_by_list(self): + m = MetaData() + tbl = Table( + 'atable', m, Column("id", Integer), Column("part_column", Integer), + postgresql_partition_by='LIST (part_column)') + self.assert_compile( + schema.CreateTable(tbl), + 'CREATE TABLE atable (id INTEGER, part_column INTEGER) ' + 'PARTITION BY LIST (part_column)') + + def test_create_table_partition_by_range(self): + m = MetaData() + tbl = Table( + 'atable', m, Column("id", Integer), Column("part_column", Integer), + postgresql_partition_by='RANGE (part_column)') + self.assert_compile( + schema.CreateTable(tbl), + 'CREATE TABLE atable (id INTEGER, part_column INTEGER) ' + 'PARTITION BY RANGE (part_column)') + def test_create_table_with_oids(self): m = MetaData() tbl = Table( |