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

ForeignKeyConstraint argument match is not rendered in autogeneration #1302

Closed
asibkamalsada opened this issue Aug 24, 2023 · 3 comments
Closed

Comments

@asibkamalsada
Copy link
Contributor

When specifying ForeignKeyConstraint(..., match="FULL") I noticed that the autogeneration does not pick up the keyword argument match.

I already checked, the constraint is interpreted correctly and only during rendering in:
https://github.com/sqlalchemy/alembic/blob/dbdec2661b8a01132ea3f7a027f85fed2eaf5e54/alembic/autogenerate/render.py#L983C25-L983C25
the argument is just silently dropped, which totally confuses me.

Am I not seeing the reason for that? I need many ForeignKeyConstraints to have full matching, this is troublesome doing by hand.

@zzzeek zzzeek added bug Something isn't working autogenerate - rendering labels Aug 24, 2023
@zzzeek
Copy link
Member

zzzeek commented Aug 24, 2023

seems like a simple oversight, can you send a PR for the lines added to

def _populate_render_fk_opts(
? a few additional lines would be added to the test at
def test_add_fk_constraint_kwarg(self):
to test the MATCH keyword.

asibkamalsada added a commit to asibkamalsada/alembic that referenced this issue Aug 25, 2023
asibkamalsada added a commit to asibkamalsada/alembic that referenced this issue Aug 25, 2023
asibkamalsada added a commit to asibkamalsada/alembic that referenced this issue Aug 25, 2023
asibkamalsada added a commit to asibkamalsada/alembic that referenced this issue Aug 25, 2023
@asibkamalsada
Copy link
Contributor Author

@zzzeek I have opened a pull request and noticed that not only the CreateForeignKeyOp was rendered incorrectly but also the ForeignKeyConstraint and fixed both as they are very closely related.

@sqla-tester
Copy link
Collaborator

Asib Kamalsada has proposed a fix for this issue in the main branch:

Add match keyword argument to rendering of foreign key constraints https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/4833

@CaselIT CaselIT added this to the 1.12 milestone Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants