thanks for finding this. this bug is fixed in revision 1592, including a new unit test.
On Jun 5, 2006, at 10:11 PM, Randall Smith wrote: > I'm getting an error that only occurs when I define my tables in a > schema. First the definitions: > > from sqlalchemy import * > from sqlalchemy.types import INTEGER, VARCHAR, TEXT, DATETIME > > # Define some global values. > schemaname='planreview' > > metadata = DynamicMetaData(name="planreview metadata") > > projects = Table('projects', metadata, > Column('id', INTEGER, primary_key=True), > Column('title', VARCHAR(200), nullable=False), > Column('project_type', VARCHAR(100), nullable=False, > default='Standard'), > Column('description', TEXT, nullable=False), > Column('reviewer_name', VARCHAR(100), nullable=False), > Column('pro_engineer_name', VARCHAR(100)), > Column('notes', TEXT, nullable=False), > schema=schemaname > ) > > actions = Table('actions', metadata, > Column('id', INTEGER, primary_key=True), > Column('name', VARCHAR(100), nullable=False), > Column('suser_name', VARCHAR(100), nullable=False), > Column('action_time', DATETIME, nullable=False, > default=func.now()), > Column('notes', TEXT, nullable=False), > Column('input_time', DATETIME, nullable=False, default=func.now > ()), > Column('project', INTEGER, > ForeignKey("%s.projects.id" % schemaname), > nullable=False), > schema=schemaname > ) > > Now the executing code: > > engine = sqla.connect('pg_dev') > engine.echo = True > planreview.metadata.connect(engine) > planreview.metadata.create_all() > > And the error: > > Traceback (most recent call last): > File "test_planreview.py", line 13, in testImport > planreview.metadata.create_all() > File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line > 633, in > create_all > File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line > 452, in run_callable > File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line > 628, in do > File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line > 655, in > _sort_tables > File "build/bdist.linux-i686/egg/sqlalchemy/sql_util.py", line > 22, in > sort > File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line > 184, in > accept_schema_visitor > File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line > 393, in > accept_schema_visitor > File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line > 456, in > accept_schema_visitor > File "build/bdist.linux-i686/egg/sqlalchemy/sql_util.py", line > 17, in > visit_foreign_key > File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line > 452, in > <lambda> > File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line > 442, in > _init_column > File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line 77, in > __call__ > ArgumentError: Table 'planreview.projects' not defined > > If I were to not use a schema, I wouldn't get any errors. > > My apologies if you get this twice. I posted earlier today and it > didn't seem to go through. > > Randall > > > > _______________________________________________ > Sqlalchemy-users mailing list > Sqlalchemy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users