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

Sqla 1.14 update #40

Merged
merged 4 commits into from
Sep 8, 2022
Merged
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
* In the next minor release (0.3.0) the row_binary option for ClickHouse serialization will be removed. The performance is significantly lower than Native format and maintaining the option adds complexity with no corresponding benefit


### Release 0.2.6 2022-09-08

#### Bug Fix
* Fixed an SQLAlchemy dialect issue with SQLAlchemy 1.4 that would cause problems in the most recent Superset version

### Release 0.2.5 2022-08-30

#### Bug Fix
Expand Down
5 changes: 3 additions & 2 deletions clickhouse_connect/cc_sqlalchemy/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ def get_check_constraints(self, connection, table_name, schema=None, **kw):
return []

def has_table(self, connection, table_name, schema=None):
row = connection.execute(f'EXISTS TABLE {full_table(table_name, schema)}').next()
return row.result == 1
result = connection.execute(f'EXISTS TABLE {full_table(table_name, schema)}')
row = result.fetchone()
return row[0] == 1

def has_sequence(self, connection, sequence_name, schema=None):
return False
Expand Down
15 changes: 10 additions & 5 deletions clickhouse_connect/driver/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,17 @@ def min_version(self, version_str: str) -> bool:
"""
Determine whether the connected server is at least the submitted version
:param version_str: Version string consisting of up to 4 integers delimited by dots
:return: 1 if the version_str is greater than the server_version, 0 if equal, -1 if less than
:return: True version_str is greater than the server_version, False if less than
"""
server_parts = [int(x) for x in self.server_version.split('.')]
server_parts.extend([0] * (4 - len(server_parts)))
version_parts = [int(x) for x in version_str.split('.')]
version_parts.extend([0] * (4 - len(version_parts)))
try:
server_parts = [int(x) for x in self.server_version.split('.')]
server_parts.extend([0] * (4 - len(server_parts)))
version_parts = [int(x) for x in version_str.split('.')]
version_parts.extend([0] * (4 - len(version_parts)))
except ValueError:
logger.warning('Server %s or requested version %s does not match format of numbers separated by dots',
self.server_version, version_str)
return False
for x, y in zip(server_parts, version_parts):
if x > y:
return True
Expand Down
6 changes: 4 additions & 2 deletions tests/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
requests
pytz
werkzeug==2.0.3
sqlalchemy>1.3.21,<1.4
apache_superset>=1.4.1
apache_superset>=2.0.0
flask==2.0.3
MarkupSafe==2.0.1
Jinja2==3.0.3
werkzeug==2.0.3
WTForms==2.3.3
cython
pytest
pytest-mock
Expand Down