]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixes to quoting on "fake" column when used off its table
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 29 Jan 2007 22:41:53 +0000 (22:41 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 29 Jan 2007 22:41:53 +0000 (22:41 +0000)
CHANGES
lib/sqlalchemy/ansisql.py
test/sql/quote.py

diff --git a/CHANGES b/CHANGES
index cc0c1b9067798a2fd10a13fce73bc9426c623ad2..44604120eacc76e4a17d9f84ab79a30ab6e6c889 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,10 @@
 0.3.5
+- sql:
+  - the value of "case_sensitive" defaults to True now, regardless of the casing
+    of the identifier, unless specifically set to False. this is because the
+    object might be label'ed as something else which does contain mixed case, and
+    propigating "case_sensitive=False" breaks that.  Other fixes to quoting
+    when using labels and "fake" column objects
 - orm:
   - further rework of the recent polymorphic relationship refactorings, as well
   as the mechanics of relationships overall.  Allows more accurate ORM behavior
@@ -9,10 +15,6 @@
   the relationship.
   - eager loading is slightly more strict about detecting "self-referential"
   relationships, specifically between polymorphic mappers.
-  - the value of "case_sensitive" defaults to True now, regardless of the casing
-    of the identifier, unless specifically set to False. this is because the
-    object might be label'ed as something else which does contain mixed case, and
-    propigating "case_sensitive=False" breaks that.
 - oracle:
   - when returning "rowid" as the ORDER BY column or in use with ROW_NUMBER OVER,
   oracle dialect checks the selectable its being applied to and will switch to 
index 803cba6d32f34688e851d27b12fb64adb0717d37..40ea5b00ac109ef6ca53767f96798e9901b25e72 100644 (file)
@@ -942,7 +942,7 @@ class ANSIIdentifierPreparer(object):
         else:
             # literal textual elements get stuck into ColumnClause alot, which shouldnt get quoted
             if use_table:
-                return column.table.name + "." + column.name
+                return self.format_table(column.table, use_schema=False) + "." + column.name
             else:
                 return column.name
             
index 8ae228031fdf2f18caa1f5d7a1e91cac52fcd812..607a595d3de33a9e1435b0a1939f4bc3477705b3 100644 (file)
@@ -96,6 +96,10 @@ class QuoteTest(PersistTest):
             Column("col1", Integer))
         x = select([table.c.col1.label("ImATable_col1")]).alias("SomeAlias")
         assert str(select([x.c.ImATable_col1])) == '''SELECT "SomeAlias"."ImATable_col1" \nFROM (SELECT "ImATable".col1 AS "ImATable_col1" \nFROM "ImATable") AS "SomeAlias"'''
+
+        x = select([sql.column("'foo'").label("somelabel")], from_obj=[table]).alias("AnAlias")
+        x = x.select()
+        assert str(x) == '''SELECT "AnAlias".somelabel \nFROM (SELECT 'foo' AS somelabel \nFROM "ImATable") AS "AnAlias"'''
         
     def testlabelsnocase(self):
         metadata = MetaData()