Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions clickhouse_sqlalchemy/alembic/comparators.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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')
Expand Down
4 changes: 3 additions & 1 deletion clickhouse_sqlalchemy/drivers/asynch/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',

@stankudrow stankudrow May 29, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello.

The version v0.2.4 and v0.2.5 are advisable to be excluded: the v0.2.4 might have (if I am not mistaken) and the v0.2.5 has issues with connection management handling logic (an example).

The v0.3.0 seems to be OK except some bugs that are currently under the progress (consider having a look at this PR) and a minor improvement here.

@stankudrow stankudrow May 29, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may do:

Suggested change
'asynch>=0.2.2,<0.4.0',
'asynch>=0.2.2,!=0.2.4,!=0.2.5,<0.4.0',

https://packaging.python.org/en/latest/specifications/version-specifiers/#id5

],
# Registering `clickhouse` as dialect.
entry_points={
Expand Down