MCPcopy Index your code
hub / github.com/piccolo-orm/piccolo / get_version

Method get_version

piccolo/engine/postgres.py:399–416  ·  view source on GitHub ↗

Returns the version of Postgres being run.

(self)

Source from the content-addressed store, hash-verified

397 return float(f"{major}.{minor}")
398
399 async def get_version(self) -> float:
400 """
401 Returns the version of Postgres being run.
402 """
403 try:
404 response: Sequence[dict] = await self._run_in_new_connection(
405 "SHOW server_version"
406 )
407 except ConnectionRefusedError as exception:
408 # Suppressing the exception, otherwise importing piccolo_conf.py
409 # containing an engine will raise an ImportError.
410 colored_warning(f"Unable to connect to database - {exception}")
411 return 0.0
412 else:
413 version_string = response[0]["server_version"]
414 return self._parse_raw_version_string(
415 version_string=version_string
416 )
417
418 def get_version_sync(self) -> float:
419 return run_sync(self.get_version())

Callers 1

get_version_syncMethod · 0.95

Calls 3

colored_warningFunction · 0.90

Tested by

no test coverage detected