diff options
| author | Marcus McCurdy <mmccurdy@50onred.com> | 2014-02-14 13:23:51 -0500 |
|---|---|---|
| committer | Marcus McCurdy <mmccurdy@50onred.com> | 2014-02-14 13:23:51 -0500 |
| commit | c597843f137b2b3ff90e648e7507dd1f325d4f48 (patch) | |
| tree | 4f61b09c0281e343a5ba3b5b3df5204a383dc502 /test/dialect | |
| parent | 036cb93abfb44f4ab7fdb125eaaf2597a95a0187 (diff) | |
| download | sqlalchemy-c597843f137b2b3ff90e648e7507dd1f325d4f48.tar.gz | |
Fixes MySQL dialect partitioning
Diffstat (limited to 'test/dialect')
| -rw-r--r-- | test/dialect/mysql/test_compiler.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/dialect/mysql/test_compiler.py b/test/dialect/mysql/test_compiler.py index 45f8405c8..24e203317 100644 --- a/test/dialect/mysql/test_compiler.py +++ b/test/dialect/mysql/test_compiler.py @@ -476,3 +476,33 @@ class SQLTest(fixtures.TestBase, AssertsCompiledSQL): 'KEY idx_autoinc_order (`order`)' ')ENGINE=InnoDB') + def test_create_table_with_partition(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)') + 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' + ) + + def test_create_table_with_partition_hash(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='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)' + ')PARTITION BY HASH(other_id) PARTITIONS 2' + ) + |
