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

Bug in _reflect_table() support for alembic versions < 1.11.0 #274

Closed
DicksonChi opened this issue Nov 8, 2023 · 0 comments
Closed

Bug in _reflect_table() support for alembic versions < 1.11.0 #274

DicksonChi opened this issue Nov 8, 2023 · 0 comments

Comments

@DicksonChi
Copy link

DicksonChi commented Nov 8, 2023

Describe the bug
Versions of alembic lower than 1.11.0 will fail with syntax error when trying to produce a migration script.

Screenshot from 2023-11-09 00-08-25

migration = produce_migrations(mig_ctx, metadata)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/alembic/autogenerate/api.py", line 164, in produce_migrations
compare._populate_migration_script(autogen_context, migration_script)
File "/usr/local/lib/python3.11/site-packages/alembic/autogenerate/compare.py", line 55, in _populate_migration_script
_produce_net_changes(autogen_context, upgrade_ops)
File "/usr/local/lib/python3.11/site-packages/alembic/autogenerate/compare.py", line 89, in _produce_net_changes
comparators.dispatch("schema", autogen_context.dialect.name)(
File "/usr/local/lib/python3.11/site-packages/alembic/util/langhelpers.py", line 267, in go
fn(*arg, **kw)
File "/usr/local/lib/python3.11/site-packages/clickhouse_sqlalchemy/alembic/comparators.py", line 130, in compare_mat_view
_reflect_table(inspector, table)
File "/usr/local/lib/python3.11/site-packages/clickhouse_sqlalchemy/alembic/comparators.py", line 41, in _reflect_table
  return _alembic_reflect_table(inspector, table)
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _reflect_table() missing 1 required positional argument: 'include_cols'

To Reproduce

from alembic.autogenerate import produce_migrations
con = "some-db-con"
mig_ctx = MigrationContext.configure(con)
migration = produce_migrations(mig_ctxt, metadata)

Expected behavior
The _reflect_table() should have an extra parameter insert_cols with it's default as None and should be passed to _alembic_reflect_table when the alembic version is < 1.11.0

Versions
clickhouse_sqlalchemy >= 0.25
alembic == 1.8.1
python == 3.11.6

  • Version of package with the problem.
  • python == 3.11.6
MordorianGuy pushed a commit to MordorianGuy/clickhouse-sqlalchemy that referenced this issue Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants