diff --git a/clickhouse_sqlalchemy/alembic/comparators.py b/clickhouse_sqlalchemy/alembic/comparators.py index 6743bea9..cab2a7c7 100644 --- a/clickhouse_sqlalchemy/alembic/comparators.py +++ b/clickhouse_sqlalchemy/alembic/comparators.py @@ -1,10 +1,8 @@ import logging -from alembic import __version__ as alembic_version from alembic.autogenerate import comparators from alembic.autogenerate.compare import _compare_columns from alembic.operations.ops import ModifyTableOps -from alembic.util.sqla_compat import _reflect_table as _alembic_reflect_table from sqlalchemy import schema as sa_schema from sqlalchemy import text @@ -13,10 +11,6 @@ logger = logging.getLogger(__name__) -alembic_version = tuple( - (int(x) if x.isdigit() else x) for x in alembic_version.split('.') -) - def _extract_to_table_name(create_table_query): query = create_table_query @@ -35,10 +29,7 @@ def _extract_to_table_name(create_table_query): def _reflect_table(inspector, table): - if alembic_version >= (1, 11, 0): - return _alembic_reflect_table(inspector, table) - else: - return _alembic_reflect_table(inspector, table, None) + return inspector.reflect_table(table, None) @comparators.dispatch_for('schema', 'clickhouse') diff --git a/clickhouse_sqlalchemy/drivers/asynch/connector.py b/clickhouse_sqlalchemy/drivers/asynch/connector.py index c0be3d5c..63b1fb83 100644 --- a/clickhouse_sqlalchemy/drivers/asynch/connector.py +++ b/clickhouse_sqlalchemy/drivers/asynch/connector.py @@ -144,9 +144,11 @@ def _init_dbapi_attributes(self): setattr(self, name, getattr(self.asynch.errors, name)) def connect(self, *args, **kwargs) -> 'AsyncAdapt_asynch_connection': + connection = self.asynch.connection.Connection(*args, **kwargs) + await_only(connection.connect()) return AsyncAdapt_asynch_connection( self, - await_only(self.asynch.connect(*args, **kwargs)) + connection ) diff --git a/setup.py b/setup.py index 2157508c..d5bcd720 100644 --- a/setup.py +++ b/setup.py @@ -99,7 +99,7 @@ def read_version(): 'sqlalchemy>=2.0.0,<2.1.0', 'requests', 'clickhouse-driver>=0.1.2', - 'asynch>=0.2.2,<=0.2.4', + 'asynch>=0.2.2,<0.4.0', ], # Registering `clickhouse` as dialect. entry_points={