Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INITIALLY, MATCH, dialect-specific arguments not supported by create_foreign_key() #190

Closed
sqlalchemy-bot opened this issue Mar 14, 2014 · 4 comments
Labels
bug Something isn't working op directives

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Michael Bayer (@zzzeek)

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

ce7ce28

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot
Copy link
Author

Saif Hakim (@saifelse) wrote:

Until this is released, what is the proper way to add a foreign key that is INITIALLY DEFERRED to an existing table?

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

if you're only targeting one database just op.execute("ALTER TABLE...").

otherwise you can go totally manually by creating a ForeignKeyConstraint() object, attach it to a Table that has the Column objects you need, then execute sqlalchemy.schema.AddConstraint(constraint) through op.execute().

still another hybrid workaround is use the internals a bit:

my_fk = op._foreign_key_constraint("my_constraint", "source", "referred", ["x", "y"], ["x", "y"]
my_fk.initially = "DEFERRED"
op.impl.add_constraint(my_fk)

if it were me I'd just run the version out of git...

@sqlalchemy-bot sqlalchemy-bot added op directives bug Something isn't working labels Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working op directives
Projects
None yet
Development

No branches or pull requests

1 participant