Skip to content

dialect_kwargs are not supported for foreign key creation #1671

@jrmalin

Description

@jrmalin

Describe the use case

SqlAlchemy supports adding dialect kwargs for foreign keys, as does op.create_foreign_key(), but the renderer for ops.CreateForeignKeyOp does not pass through dialect_kwargs. An example of this is postgresql_not_valid.

Databases / Backends / Drivers targeted

postgres

Example Use

ALTER TABLE t1 ADD CONSTRAINT i FOREIGN KEY(c1) REFERENCES t2 (c2) NOT VALID;

Additional context

This was quite confusing, as it is documented as if it is handled, and it dialect_kwargs seem to be passed through for other constraints, just not for foreign keys. I have already begun working on the solution here.

Have a nice day!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions