summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dialect/test_mysql.py12
-rw-r--r--test/dialect/test_postgresql.py10
-rw-r--r--test/sql/test_quote.py12
3 files changed, 34 insertions, 0 deletions
diff --git a/test/dialect/test_mysql.py b/test/dialect/test_mysql.py
index a805d9838..d19915266 100644
--- a/test/dialect/test_mysql.py
+++ b/test/dialect/test_mysql.py
@@ -16,6 +16,18 @@ from test.lib import *
from test.lib.engines import utf8_engine
import datetime
+class CompileTest(TestBase, AssertsCompiledSQL):
+
+ __dialect__ = mysql.dialect()
+
+ def test_reserved_words(self):
+ table = Table("mysql_table", MetaData(),
+ Column("col1", Integer),
+ Column("master_ssl_verify_server_cert", Integer))
+ x = select([table.c.col1, table.c.master_ssl_verify_server_cert])
+
+ self.assert_compile(x,
+ '''SELECT mysql_table.col1, mysql_table.`master_ssl_verify_server_cert` FROM mysql_table''')
class DialectTest(TestBase):
__only_on__ = 'mysql'
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py
index 149421404..020a92bf3 100644
--- a/test/dialect/test_postgresql.py
+++ b/test/dialect/test_postgresql.py
@@ -220,6 +220,16 @@ class CompileTest(TestBase, AssertsCompiledSQL):
'anon_1 FROM t' % (field,
compiled_expr))
+ def test_reserved_words(self):
+ table = Table("pg_table", MetaData(),
+ Column("col1", Integer),
+ Column("variadic", Integer))
+ x = select([table.c.col1, table.c.variadic])
+
+ self.assert_compile(x,
+ '''SELECT pg_table.col1, pg_table."variadic" FROM pg_table''')
+
+
class FloatCoercionTest(TablesTest, AssertsExecutionResults):
__only_on__ = 'postgresql'
__dialect__ = postgresql.dialect()
diff --git a/test/sql/test_quote.py b/test/sql/test_quote.py
index 50adad751..b31e7dfb4 100644
--- a/test/sql/test_quote.py
+++ b/test/sql/test_quote.py
@@ -169,6 +169,18 @@ class QuoteTest(TestBase, AssertsCompiledSQL):
self.assert_compile(x,
'''SELECT "SomeLabel" FROM (SELECT 'FooCol' AS "SomeLabel" FROM "ImATable")''')
+ def test_reserved_words(self):
+ metadata = MetaData()
+ table = Table("ImATable", metadata,
+ Column("col1", Integer),
+ Column("from", Integer, key="morf"),
+ Column("louisville", Integer),
+ Column("order", Integer))
+ x = select([table.c.col1, table.c.morf, table.c.louisville, table.c.order])
+
+ self.assert_compile(x,
+ '''SELECT "ImATable".col1, "ImATable"."from", "ImATable".louisville, "ImATable"."order" FROM "ImATable"''')
+
class PreparerTest(TestBase):
"""Test the db-agnostic quoting services of IdentifierPreparer."""