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

Update database.py - clickhouse new version# 21.8.15.15.altinitystable broke this code #202

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion src/infi/clickhouse_orm/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,13 @@ def _get_server_timezone(self):
def _get_server_version(self, as_tuple=True):
try:
r = self._send('SELECT version();')
ver = r.text
# ver = r.text
# The version# of clickhouse new release via Altinity is something like this: 21.8.15.15.altinitystable, a string at the end
# this broke this piece of script if it is called from sqlalchemy or any other python library.
# below is a kind of workaroud to only take the digits and dot, believe some more solid way might needed.
ver = re.sub("[^(0-9|.)]", "", r.text)
while ver[-1] == '.': ver = ver[:-1]
while ver[1] == '.': ver = ver[1:]
except ServerError as e:
logger.exception('Cannot determine server version (%s), assuming 1.1.0', e)
ver = '1.1.0'
Expand Down