summaryrefslogtreecommitdiff
path: root/test/sql/quote.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-08-31 18:58:22 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-08-31 18:58:22 +0000
commit0c7250a4740b26875d94fc9a1cb714fc970ea700 (patch)
tree79f3661459b4aab78681ae8c42f51944858ef0e9 /test/sql/quote.py
parent2e077dc627bfbc9f81cdb363a1ea1acf32f4cfe9 (diff)
downloadsqlalchemy-0c7250a4740b26875d94fc9a1cb714fc970ea700.tar.gz
- added case_sensitive argument to MetaData, Table, Column, determines
itself automatically based on if a parent schemaitem has a non-None setting for the flag, or if not, then whether the identifier name is all lower case or not. when set to True, quoting is applied to identifiers with mixed or uppercase identifiers. quoting is also applied automatically in all cases to identifiers that are known to be reserved words or contain other non-standard characters. various database dialects can override all of this behavior, but currently they are all using the default behavior. tested with postgres, mysql, sqlite. needs more testing with firebird, oracle, ms-sql. part of the ongoing work with [ticket:155]
Diffstat (limited to 'test/sql/quote.py')
-rw-r--r--test/sql/quote.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/sql/quote.py b/test/sql/quote.py
index af279ffdb..02a501003 100644
--- a/test/sql/quote.py
+++ b/test/sql/quote.py
@@ -12,14 +12,12 @@ class QuoteTest(PersistTest):
table1 = Table('WorstCase1', metadata,
Column('lowercase', Integer, primary_key=True),
Column('UPPERCASE', Integer),
- Column('MixedCase', Integer, quote=True),
- Column('ASC', Integer, quote=True),
- quote=True)
+ Column('MixedCase', Integer),
+ Column('ASC', Integer))
table2 = Table('WorstCase2', metadata,
- Column('desc', Integer, quote=True, primary_key=True),
- Column('Union', Integer, quote=True),
- Column('MixedCase', Integer, quote=True),
- quote=True)
+ Column('desc', Integer, primary_key=True),
+ Column('Union', Integer),
+ Column('MixedCase', Integer))
table1.create()
table2.create()
@@ -67,6 +65,19 @@ class QuoteTest(PersistTest):
res2 = select([table2.c.desc, table2.c.Union, table2.c.MixedCase], use_labels=True).execute().fetchall()
print res2
assert(res2==[(1,2,3),(2,2,3),(4,3,2)])
+
+ def testcascade(self):
+ lcmetadata = MetaData(case_sensitive=False)
+ t1 = Table('SomeTable', lcmetadata,
+ Column('UcCol', Integer),
+ Column('normalcol', String))
+ t2 = Table('othertable', lcmetadata,
+ Column('UcCol', Integer),
+ Column('normalcol', String, ForeignKey('SomeTable.normalcol')))
+ assert lcmetadata.case_sensitive is False
+ assert t1.c.UcCol.case_sensitive is False
+ assert t2.c.normalcol.case_sensitive is False
+
if __name__ == "__main__":
testbase.main()