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

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Mar 14, 2014

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

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 14, 2014

Michael Bayer (@zzzeek) wrote:

  • Added support for the initially, match keyword arguments
    as well as dialect-specific keyword arguments to
    :meth:.Operations.create_foreign_key.
    fixes #190

ce7ce28

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 14, 2014

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 14, 2014

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

This comment has been minimized.

sqlalchemy-bot commented Mar 14, 2014

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment