diff options
author | Jason Kirtland <jek@discorporate.us> | 2007-08-01 00:12:42 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2007-08-01 00:12:42 +0000 |
commit | c4130498c08552242797a698309af43ed5fff50c (patch) | |
tree | fb0c4c4e812a219d3416c5845df0a6b057109c7e /lib | |
parent | aac6598ecc400f9b3a8d69fae88e6882b9e7b597 (diff) | |
download | sqlalchemy-c4130498c08552242797a698309af43ed5fff50c.tar.gz |
Promoted format_table_seq from mysql to ansisql. Formats a fully qualified table reference as a quoted sequence, suitable for '.'.joining or whatever. [ticket:666]
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/ansisql.py | 14 | ||||
-rw-r--r-- | lib/sqlalchemy/databases/mysql.py | 10 |
2 files changed, 14 insertions, 10 deletions
diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py index 22227d56a..01e0a3c9d 100644 --- a/lib/sqlalchemy/ansisql.py +++ b/lib/sqlalchemy/ansisql.py @@ -1072,4 +1072,18 @@ class ANSIIdentifierPreparer(object): return self.format_column(column, use_table=True, name=column_name, table_name=table_name) + + def format_table_seq(self, table, use_schema=True): + """Format table name and schema as a tuple.""" + + # Dialects with more levels in their fully qualified references + # ('database', 'owner', etc.) could override this and return + # a longer sequence. + + if use_schema and getattr(table, 'schema', None): + return (self.quote_identifier(table.schema), + self.format_table(table, use_schema=False)) + else: + return (self.format_table(table, use_schema=False), ) + dialect = ANSIDialect diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index d25d3d041..331b672bd 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -1535,16 +1535,6 @@ class MySQLIdentifierPreparer(ansisql.ANSIIdentifierPreparer): # just leave everything as-is. return value - def format_table_seq(self, table, use_schema=True): - """Format table name and schema as a tuple.""" - - if use_schema and getattr(table, 'schema', None): - return (self.quote_identifier(table.schema), - self.format_table(table, use_schema=False)) - else: - return (self.format_table(table, use_schema=False), ) - - class MySQLCharsetOnConnect(object): """Use an alternate connection character set automatically.""" |