Hello. I had a problem described in subject. Here is the testcase:
import sqlalchemy engine = sqlalchemy.create_engine('sqlite:///:memory:') metadata = sqlalchemy.MetaData(engine) class ForeignKey(sqlalchemy.Column): def __init__(self, name, foreign_column, *args, **kwargs): fk = sqlalchemy.ForeignKey(foreign_column) super(ForeignKey, self).__init__(name, fk, *args, **kwargs) table1 = sqlalchemy.Table('table1', metadata, sqlalchemy.Column('id', sqlalchemy.Integer) ) table2 = sqlalchemy.Table('table2', metadata, ForeignKey('fk', 'table1.id') ) metadata.create_all() It fails with really strange exception: "AttributeError: 'ForeignKey' object has no attribute 'use_alter'". It was really hard to me to track down the error's nature and I found that it came from here: http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/lib/sqlalchemy/sql/visitors.py#L29 I solved my problem by adding class property __visit_name__ = 'column' to ForeignKey class. But I am a bit confused now and I have two questions about the code in sqlalchemy.sql.visitors.VisitableType.__init__() 1. What about another side-effects depending on clsname? Is it actually safe to extend sqlalchemy.schema.Column, or it may have unpredictable behavior similar to that i've encountered? 2. (almost offtopic) Is 'exec' really need there? What's wrong with closures? 3. Maybe I should send it to developers mailing list? Thanks. -- Angri --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---