diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-03-30 21:48:19 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-03-30 21:48:19 +0000 |
commit | 7512b5e5482ea8a01095f98f82f1380f19a07110 (patch) | |
tree | c262ad7eae3bb2331a9bdd46fff79c2f3f46b9d7 /lib/sqlalchemy/sql/compiler.py | |
parent | c096aeefe04ff77dbbef084923c75bf928620a27 (diff) | |
download | sqlalchemy-7512b5e5482ea8a01095f98f82f1380f19a07110.tar.gz |
- schema-qualified tables now will place the schemaname
ahead of the tablename in all column expressions as well
as when generating column labels. This prevents cross-
schema name collisions in all cases [ticket:999]
- the "use_schema" argument to compiler.visit_column() is removed. It uses
schema in all cases now.
- added a new test to the PG dialect to test roundtrip insert/update/delete/select
statements with full schema qualification
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index ee3ecc1f1..76e2ca260 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -249,14 +249,9 @@ class DefaultCompiler(engine.Compiled): return " ".join([self.process(label.obj), self.operator_string(operators.as_), self.preparer.format_label(label, labelname)]) - def visit_column(self, column, result_map=None, use_schema=False, **kwargs): - # there is actually somewhat of a ruleset when you would *not* necessarily - # want to truncate a column identifier, if its mapped to the name of a - # physical column. but thats very hard to identify at this point, and - # the identifier length should be greater than the id lengths of any physical - # columns so should not matter. - - if use_schema and getattr(column, 'table', None) and getattr(column.table, 'schema', None): + def visit_column(self, column, result_map=None, **kwargs): + + if getattr(column, 'table', None) and getattr(column.table, 'schema', None): schema_prefix = self.preparer.quote(column.table, column.table.schema) + '.' else: schema_prefix = '' @@ -278,7 +273,7 @@ class DefaultCompiler(engine.Compiled): return schema_prefix + self.preparer.quote(column.table, ANONYMOUS_LABEL.sub(self._process_anon, column.table.name)) + "." + n elif len(column.table.primary_key) != 0: pk = list(column.table.primary_key)[0] - return self.visit_column(pk, result_map=result_map, use_schema=use_schema, **kwargs) + return self.visit_column(pk, result_map=result_map, **kwargs) else: return None elif column.table is None or not column.table.named_with_column: |