On Nov 7, 2008, at 10:37 AM, sector119 wrote:
>
> Hi!
>
> I have people_table:
>
> people_table = sa.Table('people', meta.metadata,
> sa.Column('id', sa.types.Integer, primary_key=True,
> autoincrement=False),
> sa.Column('street_id', sa.types.Integer,
> sa.ForeignKey('streets.id'), nullable=False),
> sa.Column('first_name', sa.types.Unicode(255), nullable=True),
> sa.Column('last_name', sa.types.Unicode(255), nullable=False)
> )
>
> And I have to create that table at different than public schema.
> If I do people_table.tometadata(meta.metadata,
> schema='myschema').create() sqlalchemy create table but with street_id
> = ForeignKey('streets.id') not ForeignKey('myschema.streets.id')
> How to make FK's follow new table schema or how to change foreign key
> target on the fly?
> With people_table.foreign_keys[0].target_fullname =
> 'myschema.streets.id' it doesn't work ? I get AttributeError: can't
> change attribute
to metadata() is not a widely used feature so I'd describe that
behavior as a bug. The ForeignKey should be converted over. As far
as your workaround, set the value on "_colspec" rather than
"target_fullname" and that should clear it up.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---