diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-02-25 07:12:50 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-02-25 07:12:50 +0000 |
| commit | 72dd2b08beb9803269983aa220e75b44007e5158 (patch) | |
| tree | 16f80b5f869ba68ae17e2fcbe9b18f1542b22e84 /lib/sqlalchemy/databases | |
| parent | 5b81c1a2d0915d95d9928ffaaf81af814cf4ec3e (diff) | |
| download | sqlalchemy-72dd2b08beb9803269983aa220e75b44007e5158.tar.gz | |
merged sql_rearrangement branch , refactors sql package to work standalone with
clause elements including tables and columns, schema package deals with "physical"
representations
Diffstat (limited to 'lib/sqlalchemy/databases')
| -rw-r--r-- | lib/sqlalchemy/databases/mysql.py | 22 | ||||
| -rw-r--r-- | lib/sqlalchemy/databases/postgres.py | 2 |
2 files changed, 6 insertions, 18 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index 04bdc24fa..d660db7bd 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -131,11 +131,6 @@ class MySQLEngine(ansisql.ANSISQLEngine): def supports_sane_rowcount(self): return False - def tableimpl(self, table, **kwargs): - """returns a new sql.TableImpl object to correspond to the given Table object.""" - mysql_engine = kwargs.pop('mysql_engine', None) - return MySQLTableImpl(table, mysql_engine=mysql_engine) - def compiler(self, statement, bindparams, **kwargs): return MySQLCompiler(self, statement, bindparams, **kwargs) @@ -175,7 +170,7 @@ class MySQLEngine(ansisql.ANSISQLEngine): #ischema.reflecttable(self, table, ischema_names, use_mysql=True) tabletype, foreignkeyD = self.moretableinfo(table=table) - table._impl.mysql_engine = tabletype + table.kwargs['mysql_engine'] = tabletype c = self.execute("describe " + table.name, {}) while True: @@ -235,14 +230,6 @@ class MySQLEngine(ansisql.ANSISQLEngine): return (tabletype, foreignkeyD) -class MySQLTableImpl(sql.TableImpl): - """attached to a schema.Table to provide it with a Selectable interface - as well as other functions - """ - def __init__(self, table, mysql_engine=None): - super(MySQLTableImpl, self).__init__(table) - self.mysql_engine = mysql_engine - class MySQLCompiler(ansisql.ANSICompiler): def visit_function(self, func): @@ -277,12 +264,13 @@ class MySQLSchemaGenerator(ansisql.ANSISchemaGenerator): if first_pk and isinstance(column.type, types.Integer): colspec += " AUTO_INCREMENT" if column.foreign_key: - colspec += ", FOREIGN KEY (%s) REFERENCES %s(%s)" % (column.name, column.column.foreign_key.column.table.name, column.column.foreign_key.column.name) + colspec += ", FOREIGN KEY (%s) REFERENCES %s(%s)" % (column.name, column.foreign_key.column.table.name, column.foreign_key.column.name) return colspec def post_create_table(self, table): - if table.mysql_engine is not None: - return " ENGINE=%s" % table.mysql_engine + mysql_engine = table.kwargs.get('mysql_engine', None) + if mysql_engine is not None: + return " ENGINE=%s" % mysql_engine else: return "" diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 2115f5d56..238310b1b 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -312,7 +312,7 @@ class PGSchemaGenerator(ansisql.ANSISchemaGenerator): if column.primary_key and not override_pk: colspec += " PRIMARY KEY" if column.foreign_key: - colspec += " REFERENCES %s(%s)" % (column.column.foreign_key.column.table.fullname, column.column.foreign_key.column.name) + colspec += " REFERENCES %s(%s)" % (column.foreign_key.column.table.fullname, column.foreign_key.column.name) return colspec def visit_sequence(self, sequence): |
