Skip to content

Commit

Permalink
possible smarter versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
bdpedigo committed Sep 11, 2024
1 parent 6c2e299 commit 7b4d711
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion caveclient/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ def server_version(self) -> Optional[Version]:
"""The version of the service running on the remote server. Note that this
refers to the software running on the server and has nothing to do with the
version of the datastack itself."""
return self._server_version
if self._server_version is None and self._api_version is not None:
return Version(str(self._api_version))
else:
return self._server_version

@staticmethod
def raise_for_status(r, log_warning=True):
Expand Down
7 changes: 4 additions & 3 deletions caveclient/materializationengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from cachetools import TTLCache, cached
from cachetools.keys import hashkey
from IPython.display import HTML
from packaging.version import Version
from requests import HTTPError

from .auth import AuthClient
Expand Down Expand Up @@ -1659,7 +1660,7 @@ def _assemble_attributes(
@property
def tables(self) -> TableManager:
"""The table manager for the materialization engine."""
if self.server_version < "3.0.0":
if self.server_version < Version("3"):
if self._tables is None:
if self.fc is not None and self.fc._materialize is not None:
self._tables = TableManager(self.fc)
Expand Down Expand Up @@ -1698,7 +1699,7 @@ def tables(self) -> TableManager:
@property
def views(self) -> ViewManager:
"""The view manager for the materialization engine."""
if self.server_version < "3.0.0":
if self.server_version < Version("3"):
if self._views is None:
if self.fc is not None and self.fc._materialize is not None:
self._views = ViewManager(self.fc)
Expand Down Expand Up @@ -1896,7 +1897,7 @@ def live_live_query(
>>> "column_name": "regex_string"
>>> }
"""
if self.server_version < 3:
if self.server_version < Version("3"):
logging.warning(
"Deprecation: this method is to facilitate beta testing of this feature, \
it will likely get removed in future versions. "
Expand Down

0 comments on commit 7b4d711

Please sign in to comment.