summaryrefslogtreecommitdiff
path: root/test/dialect/mysql/test_compiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/dialect/mysql/test_compiler.py')
-rw-r--r--test/dialect/mysql/test_compiler.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/dialect/mysql/test_compiler.py b/test/dialect/mysql/test_compiler.py
index 35ff603a8..be5f002e3 100644
--- a/test/dialect/mysql/test_compiler.py
+++ b/test/dialect/mysql/test_compiler.py
@@ -607,6 +607,26 @@ class SQLTest(fixtures.TestBase, AssertsCompiledSQL):
')PARTITION BY KEY(other_id) PARTITIONS 2'
)
+ def test_create_table_with_subpartition(self):
+ t1 = Table(
+ 'testtable', MetaData(),
+ Column('id', Integer(), primary_key=True, autoincrement=True),
+ Column('other_id', Integer(), primary_key=True,
+ autoincrement=False),
+ mysql_partitions='2',
+ mysql_partition_by='KEY(other_id)',
+ mysql_subpartition_by="HASH(some_expr)",
+ mysql_subpartitions='2')
+ self.assert_compile(
+ schema.CreateTable(t1),
+ 'CREATE TABLE testtable ('
+ 'id INTEGER NOT NULL AUTO_INCREMENT, '
+ 'other_id INTEGER NOT NULL, '
+ 'PRIMARY KEY (id, other_id)'
+ ')PARTITION BY KEY(other_id) PARTITIONS 2 '
+ 'SUBPARTITION BY HASH(some_expr) SUBPARTITIONS 2'
+ )
+
def test_create_table_with_partition_hash(self):
t1 = Table(
'testtable', MetaData(),
@@ -623,6 +643,23 @@ class SQLTest(fixtures.TestBase, AssertsCompiledSQL):
')PARTITION BY HASH(other_id) PARTITIONS 2'
)
+ def test_create_table_with_partition_and_other_opts(self):
+ t1 = Table(
+ 'testtable', MetaData(),
+ Column('id', Integer(), primary_key=True, autoincrement=True),
+ Column('other_id', Integer(), primary_key=True,
+ autoincrement=False),
+ mysql_stats_sample_pages='2',
+ mysql_partitions='2', mysql_partition_by='HASH(other_id)')
+ self.assert_compile(
+ schema.CreateTable(t1),
+ 'CREATE TABLE testtable ('
+ 'id INTEGER NOT NULL AUTO_INCREMENT, '
+ 'other_id INTEGER NOT NULL, '
+ 'PRIMARY KEY (id, other_id)'
+ ')STATS_SAMPLE_PAGES=2 PARTITION BY HASH(other_id) PARTITIONS 2'
+ )
+
def test_inner_join(self):
t1 = table('t1', column('x'))
t2 = table('t2', column('y'))