return expression.literal_column(_quote_ddl_expr(element.value))
elif isinstance(element, expression.ColumnClause) and \
element.table is not None:
- return expression.column(element.name)
+ col = expression.column(element.name)
+ col.quote = element.quote
+ return col
else:
return None
'Foo.T1'
)
+ def test_quote_flag_propagate_check_constraint(self):
+ m = MetaData()
+ t = Table('t', m, Column('x', Integer, quote=True))
+ CheckConstraint(t.c.x > 5)
+ self.assert_compile(
+ schema.CreateTable(t),
+ "CREATE TABLE t ("
+ '"x" INTEGER, '
+ 'CHECK ("x" > 5)'
+ ")"
+ )
+
+ def test_quote_flag_propagate_index(self):
+ m = MetaData()
+ t = Table('t', m, Column('x', Integer, quote=True))
+ idx = Index("foo", t.c.x)
+ self.assert_compile(
+ schema.CreateIndex(idx),
+ 'CREATE INDEX foo ON t ("x")'
+ )
+
+
class PreparerTest(fixtures.TestBase):
"""Test the db-agnostic quoting services of IdentifierPreparer."""
a_eq(unformat('foo.`bar`'), ['foo', 'bar'])
a_eq(unformat('`foo`.bar'), ['foo', 'bar'])
a_eq(unformat('`foo`.`b``a``r`.`baz`'), ['foo', 'b`a`r', 'baz'])
+