Skip to content

Commit

Permalink
[BugFix] making this version comparison more resilient as it fails is…
Browse files Browse the repository at this point in the history
…sues/41016 (#42198)

Fixed #41016 which causes problems with version 3.2
Used to spit out
'>' not supported between instances of 'int' and 'str'
Signed-off-by: Fardin Sarker <[email protected]>
  • Loading branch information
fardinsarker authored Mar 6, 2024
1 parent a8246c2 commit 81219ae
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions contrib/dbt-connector/dbt/adapters/starrocks/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,9 @@ def is_before_version(self, version: str) -> bool:
conn = self.connections.get_if_exists()
if conn:
server_version = conn.handle.server_version
version_detail = version.split(".")
version_detail = (int(version_detail[0]), int(version_detail[1]), int(version_detail[2]))
if version_detail[0] > server_version[0]:
return True
elif version_detail[0] == server_version[0] and version_detail[1] > server_version[1]:
return True
elif version_detail[0] == server_version[0] and version_detail[1] == server_version[1] \
and version_detail[2] > server_version[2]:
server_version_tuple = tuple(int(part) for part in server_version if part.isdigit())
version_detail_tuple = tuple(int(part) for part in version.split(".") if part.isdigit())
if version_detail_tuple > server_version_tuple:
return True
return False

Expand Down

0 comments on commit 81219ae

Please sign in to comment.