Skip to content

Commit

Permalink
making this version comparison more resilient as it fails issues/41016
Browse files Browse the repository at this point in the history
  • Loading branch information
Fardin Sarker committed Mar 6, 2024
1 parent 0fb6375 commit e1dcb51
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 e1dcb51

Please sign in to comment.