summaryrefslogtreecommitdiff
path: root/test/sql
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
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')
-rw-r--r--test/sql/quote.py25
-rw-r--r--test/sql/select.py14
2 files changed, 25 insertions, 14 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()
diff --git a/test/sql/select.py b/test/sql/select.py
index e43d30c54..7711e2908 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -344,9 +344,9 @@ FROM mytable, myothertable WHERE foo.id = foofoo(lala) AND datetime(foo) = Today
def testcalculatedcolumns(self):
value_tbl = table('values',
- Column('id', Integer),
- Column('val1', Float),
- Column('val2', Float),
+ column('id', Integer),
+ column('val1', Float),
+ column('val2', Float),
)
self.runtest(
@@ -549,10 +549,10 @@ FROM mytable, myothertable WHERE mytable.myid = myothertable.otherid AND mytable
def testcast(self):
tbl = table('casttest',
- Column('id', Integer),
- Column('v1', Float),
- Column('v2', Float),
- Column('ts', TIMESTAMP),
+ column('id', Integer),
+ column('v1', Float),
+ column('v2', Float),
+ column('ts', TIMESTAMP),
)
def check_results(dialect, expected_results, literal):