On Jan 21, 2014, at 6:21 AM, [email protected] wrote:
> I'm using SQLAlchemy declarative extension, and I have new class inheriting > from Base > with such foreign key contraints : > > __table_args__ = ( > ForeignKeyConstraint( > ['MarketType', 'ItemGroup'], > ['MarketCommodity.MarketType', 'MarketCommodity.ItemGroup_pk', ]), > ForeignKeyConstraint( > ["Price_pk", "PriceCondition_pk", "DocumentDetail_pk"], > [ > 'Price.Price_pk', > 'Price.PriceCondition_pk', > 'Price.DocumentDetail_pk' > ]), > ) > > So, how to adjust my alembic migration script to handle these constraints? > The op.create_foreign_key does not seem to be able to handle this case. > My database is a postgreSQL one. create_foreign_key accepts lists of column names: create_foreign_key(“fk_market_type”, “market”, “marketcommodity”, [“markettype”, “itemgroup”], [“markettype”, “itemgroup_pk”]) https://alembic.readthedocs.org/en/latest/ops.html?highlight=create_foreign_key#alembic.operations.Operations.create_foreign_key
signature.asc
Description: Message signed with OpenPGP using GPGMail
