clickhouse-sqlalchemy
clickhouse-sqlalchemy copied to clipboard
Bug in _reflect_table() support for alembic versions < 1.11.0
Describe the bug Versions of alembic lower than 1.11.0 will fail with syntax error when trying to produce a migration script.
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