mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-11-01 15:53:03 -06:00
21 lines
664 B
Python
21 lines
664 B
Python
##########################################################################
|
|
#
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
#
|
|
# Copyright (C) 2013 - 2026, The pgAdmin Development Team
|
|
# This software is released under the PostgreSQL Licence
|
|
#
|
|
##########################################################################
|
|
|
|
import re
|
|
|
|
|
|
def normalize_database_uri(uri):
|
|
"""
|
|
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.
|
|
"""
|
|
return re.sub(r"^postgres(?:ql)?://",
|
|
"postgresql+psycopg://", uri, count=1)
|