From: Mike Bayer Date: Mon, 29 Jan 2007 22:41:53 +0000 (+0000) Subject: fixes to quoting on "fake" column when used off its table X-Git-Tag: rel_0_3_5~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac4b2a8d18c026bb5fa3efd82b59cba6ed89bd75;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fixes to quoting on "fake" column when used off its table --- diff --git a/CHANGES b/CHANGES index cc0c1b9067..44604120ea 100644 --- 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 diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py index 803cba6d32..40ea5b00ac 100644 --- a/lib/sqlalchemy/ansisql.py +++ b/lib/sqlalchemy/ansisql.py @@ -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 diff --git a/test/sql/quote.py b/test/sql/quote.py index 8ae228031f..607a595d3d 100644 --- a/test/sql/quote.py +++ b/test/sql/quote.py @@ -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()