Fix rendering of Column objects in dialect kwargs like postgresql_inc…#1802
Fix rendering of Column objects in dialect kwargs like postgresql_inc…#1802Ajaysingh-2003 wants to merge 1 commit intosqlalchemy:mainfrom
Conversation
CaselIT
left a comment
There was a problem hiding this comment.
thanks. looks almost ok:
- left a comment
- could you add a changenote here https://github.com/sqlalchemy/alembic/tree/main/docs/build/unreleased? the number is the issue. Feel free to add
Pull request courtesy of <your>at the end
| idx = Index( | ||
| "test_active_code_idx", | ||
| t.c.active, | ||
| somedialect_include=[t.c.code], |
There was a problem hiding this comment.
Updated, both tests now use tuples.
There was a problem hiding this comment.
I suggested only one to that we kept leveraging both code paths in the test. if it's not too much of a both I would prefer if one of the two test kept using list, so that ensure that both work.
thanks!
There was a problem hiding this comment.
Done! I updated test_render_drop_index to use a Tuple as requested, while keeping test_render_add_index as a List to comprehensively test both code paths. The tests compile properly.
fefa96d to
20a50c9
Compare
Done — added the changenote in docs/build/unreleased/1258.rst and switched the tests to use tuples. |
20a50c9 to
b6b8326
Compare
b6b8326 to
2a0441c
Compare
|
the fails seem unrelated. thanks! |
sqla-tester
left a comment
There was a problem hiding this comment.
OK, this is sqla-tester setting up my work on behalf of CaselIT to try to get revision 2a0441c of this pull request into gerrit so we can run tests and reviews and stuff
|
New Gerrit review created for change 2a0441c: https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/6647 |
heyy. Any updates on the PR?? Anything to change or update? |
|
Sorry I was mostly waiting for Mike to get back from holiday |
Alright, thanks. |
|
Michael Bayer (zzzeek) wrote: I moved the logic added to _render_dialect_kwargs_items directly into _render_potential_expr() so it can take effect in general. @CaselIT take another look if you can View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/6647 |
sqla-tester
left a comment
There was a problem hiding this comment.
Federico Caselli (CaselIT) wrote:
makes sense, left a question, but otherwise seems good
View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/6647
- alembic/autogenerate/render.py (line 635): do we actually need this now? can't we use the if below for ClauseElement?
sqla-tester
left a comment
There was a problem hiding this comment.
Michael Bayer (zzzeek) wrote:
code review left on gerrit
View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/6647
- alembic/autogenerate/render.py (line 635): it's still two isinstance() checks either way, so i just did it this way. how would you do it?
sqla-tester
left a comment
There was a problem hiding this comment.
Federico Caselli (CaselIT) wrote:
code review left on gerrit
View this in Gerrit at https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/6647
- alembic/autogenerate/render.py (line 635): we did not need this before, that's all I'm saying. but it's fine to keep, no other test is affected so that's fine
Fixes #1258
This PR updates
_render_dialect_kwargs_itemsinalembic/autogenerate/render.pyto properly handle list/tuple values containing Column objects, such aspostgresql_include.The implementation mirrors the logic used in
_get_index_rendered_expressions, ensuring consistent rendering behavior.Changes:
Tests:
This ensures Alembic generates valid migration scripts when using
postgresql_include.