|
13 | 13 | from ..error.endpoint_suggester import generate_suggestive_error_message |
14 | 14 | from ..error.gds_not_installed import GdsNotFound |
15 | 15 | from ..error.unable_to_connect import UnableToConnectError |
| 16 | +from ..semantic_version.semantic_version import SemanticVersion |
16 | 17 | from ..server_version.server_version import ServerVersion |
17 | 18 | from ..version import __version__ |
18 | 19 | from .cypher_graph_constructor import CypherGraphConstructor |
|
24 | 25 | class Neo4jQueryRunner(QueryRunner): |
25 | 26 | _AURA_DS_PROTOCOL = "neo4j+s" |
26 | 27 | _LOG_POLLING_INTERVAL = 0.5 |
27 | | - _NEO4J_DRIVER_VERSION = ServerVersion.from_string(neo4j.__version__) |
| 28 | + _NEO4J_DRIVER_VERSION = SemanticVersion.from_string(neo4j.__version__) |
28 | 29 |
|
29 | 30 | @staticmethod |
30 | 31 | def create_for_db( |
@@ -60,7 +61,7 @@ def create_for_db( |
60 | 61 | else: |
61 | 62 | raise ValueError(f"Invalid endpoint type: {type(endpoint)}") |
62 | 63 |
|
63 | | - if Neo4jQueryRunner._NEO4J_DRIVER_VERSION >= ServerVersion(5, 21, 0): |
| 64 | + if Neo4jQueryRunner._NEO4J_DRIVER_VERSION >= SemanticVersion(5, 21, 0): |
64 | 65 | notifications_logger = logging.getLogger("neo4j.notifications") |
65 | 66 | # the client does not expose YIELD fields so we just skip these warnings for now |
66 | 67 | notifications_logger.addFilter( |
@@ -93,7 +94,7 @@ def create_for_session( |
93 | 94 | instance_description="GDS Session", |
94 | 95 | ) |
95 | 96 |
|
96 | | - if Neo4jQueryRunner._NEO4J_DRIVER_VERSION >= ServerVersion(5, 21, 0): |
| 97 | + if Neo4jQueryRunner._NEO4J_DRIVER_VERSION >= SemanticVersion(5, 21, 0): |
97 | 98 | notifications_logger = logging.getLogger("neo4j.notifications") |
98 | 99 | # the client does not expose YIELD fields so we just skip these warnings for now |
99 | 100 | notifications_logger.addFilter( |
@@ -175,13 +176,13 @@ def run_cypher( |
175 | 176 |
|
176 | 177 | df = result.to_df() |
177 | 178 |
|
178 | | - if self._NEO4J_DRIVER_VERSION < ServerVersion(5, 0, 0): |
| 179 | + if self._NEO4J_DRIVER_VERSION < SemanticVersion(5, 0, 0): |
179 | 180 | self._last_bookmarks = [session.last_bookmark()] |
180 | 181 | else: |
181 | 182 | self._last_bookmarks = session.last_bookmarks() |
182 | 183 |
|
183 | 184 | if ( |
184 | | - Neo4jQueryRunner._NEO4J_DRIVER_VERSION >= ServerVersion(5, 21, 0) |
| 185 | + Neo4jQueryRunner._NEO4J_DRIVER_VERSION >= SemanticVersion(5, 21, 0) |
185 | 186 | and result._warn_notification_severity == "WARNING" |
186 | 187 | ): |
187 | 188 | # the client does not expose YIELD fields so we just skip these warnings for now |
@@ -342,7 +343,7 @@ def _verify_connectivity( |
342 | 343 | retrys = 0 |
343 | 344 | while retrys < retry_config.max_retries: |
344 | 345 | try: |
345 | | - if self._NEO4J_DRIVER_VERSION < ServerVersion(5, 0, 0): |
| 346 | + if self._NEO4J_DRIVER_VERSION < SemanticVersion(5, 0, 0): |
346 | 347 | warnings.filterwarnings( |
347 | 348 | "ignore", |
348 | 349 | category=neo4j.ExperimentalWarning, |
|
0 commit comments