Hi Florian,

the following patch sorts out creation problem. btw. i couldn't repeat
the other problems you have - your test code worked without problem on
svn trunk.

- andrija

On 08/03/06, Florian Boesch <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've got a problem with the svn trunk and table creation of tables that 
> contain
> foreign keys.
>
> Demo programm:
>
> engine = create_engine('oracle://dsn=orcl&user=asfd&password=asfd')
>
> foo = Table('foo', engine,
>     Column('id', Integer, Sequence('foo_seq'), primary_key=True))
>
> bar = Table('bar', engine,
>     Column('id', Integer, Sequence('bar_seq'), primary_key=True),
>     Column('foo_id', Integer, ForeignKey('foo.id')))
>
> foo.create()
> bar.create()
>
> Error:
> Traceback (most recent call last):
>   File "testalchemy.py", line 75, in ?
>     bar.create()
>   File
> "/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.3-py2.4.egg/sqlalchemy/schema.py",
> line 212, in create
>     self.engine.create(self)
>   File
> "/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.3-py2.4.egg/sqlalchemy/engine.py",
> line 319, in create
>     entity.accept_schema_visitor(self.schemagenerator(**params))
>   File
> "/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.3-py2.4.egg/sqlalchemy/schema.py",
> line 179, in accept_schema_visitor
>     return visitor.visit_table(self)
>   File
> "/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.3-py2.4.egg/sqlalchemy/ansisql.py",
> line 578, in visit_table
>     self.append("\t" + self.get_column_specification(column,
> override_pk=len(pks)>1, first_pk=column.primary_key and not first_pk))
>   File
> "/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.3-py2.4.egg/sqlalchemy/databases/oracle.py",
> line 313, in get_column_specification
>     colspec += " REFERENCES %s(%s)" %
> (column.column.foreign_key.column.table.name,
> column.column.foreign_key.column.name)
> AttributeError: 'Column' object has no attribute 'column'
>
> I now go back to sqlalchemy 0.1.2.
>
> Regards,
> Florian
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
Index: lib/sqlalchemy/databases/oracle.py
===================================================================
--- lib/sqlalchemy/databases/oracle.py	(revision 1111)
+++ lib/sqlalchemy/databases/oracle.py	(working copy)
@@ -310,7 +310,7 @@
         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.name, column.column.foreign_key.column.name) 
+            colspec += " REFERENCES %s(%s)" % (column.foreign_key.column.table.name, column.foreign_key.column.name) 
         return colspec
 
     def visit_sequence(self, sequence):

Reply via email to