Foreign key error gives TypeError: 'unicode' object is not callable

Issue #1241 resolved
Former user created an issue

When I get an error message for a missing foreign key in a unicode database I get this:

In 10: md.reflect(schema="review", only=("al_ids",))

TypeError Traceback (most recent call last)

/home/joakim/workspace/alaSemantic/<ipython console> in <module>()

/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc4-py2.5.egg/sqlalchemy/schema.pyc in reflect(self, bind, schema, only) 1611 1612 for name in load: -> 1613 Table(name, self, **reflect_opts) 1614 1615 def append_ddl_listener(self, event, listener):

/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc4-py2.5.egg/sqlalchemy/schema.pyc in call(self, name, metadata, args, kwargs) 110 "Table '%s' not defined" % (key)) 111 try: --> 112 return type.call(self, name, metadata, args, **kwargs) 113 except: 114 if key in metadata.tables:

/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc4-py2.5.egg/sqlalchemy/schema.pyc in init(self, name, metadata, args, *kwargs) 239 autoload_with.reflecttable(self, include_columns=include_columns) 240 else: --> 241 _bind_or_error(metadata).reflecttable(self, include_columns=include_columns) 242 243 # initialize all the column, etc. objects. done after reflection to

/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc4-py2.5.egg/sqlalchemy/engine/base.pyc in reflecttable(self, table, connection, include_columns) 1235 conn = connection 1236 try: -> 1237 self.dialect.reflecttable(conn, table, include_columns) 1238 finally: 1239 if connection is None:

/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc4-py2.5.egg/sqlalchemy/databases/mysql.pyc in reflecttable(self, connection, table, include_columns) 1703 1704 return reflector.reflect(connection, table, sql, charset, -> 1705 only=include_columns) 1706 1707 def _adjust_casing(self, connection, table, charset=None):

/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc4-py2.5.egg/sqlalchemy/databases/mysql.pyc in reflect(self, connection, table, show_create, charset, only) 2184 2185 self._set_keys(table, keys, only) -> 2186 self._set_constraints(table, constraints, connection, only) 2187 2188 def _set_name(self, table, line):

/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc4-py2.5.egg/sqlalchemy/databases/mysql.pyc in _set_constraints(self, table, constraints, connection, only) 2364 "Foreign key columns (%s) are not present on " 2365 "foreign table %s" % -> 2366 (', '.join(ref_names), ref_table.fullname())) 2367 ref_columns = [ref_table.cname for name in ref_names] 2368

TypeError: 'unicode' object is not callable

Attached patch fixes this

Comments (3)

  1. Log in to comment