MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / normalize_database_uri

Function normalize_database_uri

web/pgadmin/utils/db_utils.py:13–20  ·  view source on GitHub ↗

Rewrite a bare postgres(ql):// URI to use the psycopg3 driver scheme postgresql+psycopg://. URIs that already carry a driver specifier (e.g. postgresql+psycopg://) are returned unchanged.

(uri)

Source from the content-addressed store, hash-verified

11
12
13def normalize_database_uri(uri):
14 """
15 Rewrite a bare postgres(ql):// URI to use the psycopg3 driver scheme
16 postgresql+psycopg://. URIs that already carry a driver specifier
17 (e.g. postgresql+psycopg://) are returned unchanged.
18 """
19 return re.sub(r"^postgres(?:ql)?://",
20 "postgresql+psycopg://", uri, count=1)

Callers 4

create_appFunction · 0.90
check_external_config_dbFunction · 0.90
runTestMethod · 0.90

Calls

no outgoing calls

Tested by 1

runTestMethod · 0.72