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

Broken import due to Alembic removed _reflect_table #368

Open
thomas-dufour opened this issue Mar 7, 2025 · 0 comments · May be fixed by #369
Open

Broken import due to Alembic removed _reflect_table #368

thomas-dufour opened this issue Mar 7, 2025 · 0 comments · May be fixed by #369

Comments

@thomas-dufour
Copy link

Describe the bug
Alembic version 1.15 removed function _reflect_table from alembic/util/sqla_compat.py. This prevents the import of clickhouse_sqlalchemy.alembic.dialect in my alembic/env.py file as I was taking example on https://github.com/xzkostyan/clickhouse-sqlalchemy-alembic-example/blob/main/simple/migrations/env.py.

I plan to open a PR soon. I already did a patch on a local fork of clickhouse-sqlalchemy that solve the problem.

To Reproduce
A minimal reproduction is to execute this python script directly with alembic 1.15

from alembic.util import sqla_compat

# uncomment next line to make it work with alembic >=1.15
# sqla_compat._reflect_table = lambda inspector, table, include_cols: inspector.reflect_table(table, None)
from clickhouse_sqlalchemy.alembic.dialect import include_object, patch_alembic_version

print("OK")
Traceback (most recent call last):
  File ".../alembic/env.py", line 5, in <module>
    from clickhouse_sqlalchemy.alembic.dialect import include_object, patch_alembic_version
  File "clickhouse-sqlalchemy/clickhouse_sqlalchemy/alembic/dialect.py", line 13, in <module>
    from .comparators import compare_mat_view
  File "clickhouse-sqlalchemy/clickhouse_sqlalchemy/alembic/comparators.py", line 7, in <module>
    from alembic.util.sqla_compat import _reflect_table as _alembic_reflect_table
ImportError: cannot import name '_reflect_table' from 'alembic.util.sqla_compat'

Expected behavior
imports should works

Versions

  • alembic==1.15.1
  • clickhouse-sqlalchemy==0.3.2
  • Python 3.12.8
thomas-dufour pushed a commit to thomas-dufour/clickhouse-sqlalchemy that referenced this issue Mar 7, 2025
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

Successfully merging a pull request may close this issue.

1 participant