Skip to content

Commit

Permalink
Update connection parameter resolution (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaclarke authored Oct 28, 2021
1 parent d9a12b8 commit 085f574
Show file tree
Hide file tree
Showing 6 changed files with 712 additions and 653 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "edgedb/pgproto"]
path = edgedb/pgproto
url = https://github.com/MagicStack/py-pgproto.git
[submodule "tests/shared-client-testcases"]
path = tests/shared-client-testcases
url = https://github.com/edgedb/shared-client-testcases.git
10 changes: 5 additions & 5 deletions edgedb/asyncio_con.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,9 @@ async def fetchone_json(self, query: str, *args, **kwargs) -> str:


async def async_connect(dsn: str = None, *,
credentils_file: str = None,
host: str = None, port: int = None,
user: str = None, password: str = None,
admin: bool = None,
database: str = None,
tls_ca_file: str = None,
tls_verify_hostname: bool = None,
Expand All @@ -537,9 +537,9 @@ async def async_connect(dsn: str = None, *,
if connection_class is None:
connection_class = AsyncIOConnection

addrs, params, config = con_utils.parse_connect_arguments(
dsn=dsn, host=host, port=port, user=user, password=password,
database=database, admin=admin, timeout=timeout,
connect_config, client_config = con_utils.parse_connect_arguments(
dsn=dsn, credentials_file=credentils_file, host=host, port=port,
user=user, password=password, database=database, timeout=timeout,
tls_ca_file=tls_ca_file, tls_verify_hostname=tls_verify_hostname,
wait_until_available=wait_until_available,

Expand All @@ -548,7 +548,7 @@ async def async_connect(dsn: str = None, *,
server_settings=None)

connection = connection_class(
loop, addrs, config, params,
loop, [connect_config.address], client_config, connect_config,
codecs_registry=_CodecsRegistry(),
query_cache=_QueryCodecsCache(),
)
Expand Down
11 changes: 6 additions & 5 deletions edgedb/blocking_con.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,18 +425,18 @@ def is_closed(self) -> bool:


def connect(dsn: str = None, *,
credentials_file: str = None,
host: str = None, port: int = None,
user: str = None, password: str = None,
admin: bool = None,
database: str = None,
tls_ca_file: str = None,
tls_verify_hostname: bool = None,
timeout: int = 10,
wait_until_available: int = 30) -> BlockingIOConnection:

addrs, params, config = con_utils.parse_connect_arguments(
dsn=dsn, host=host, port=port, user=user, password=password,
database=database, admin=admin,
connect_config, client_config = con_utils.parse_connect_arguments(
dsn=dsn, credentials_file=credentials_file, host=host, port=port,
user=user, password=password, database=database,
timeout=timeout,
wait_until_available=wait_until_available,
tls_ca_file=tls_ca_file, tls_verify_hostname=tls_verify_hostname,
Expand All @@ -446,7 +446,8 @@ def connect(dsn: str = None, *,
server_settings=None)

conn = BlockingIOConnection(
addrs=addrs, params=params, config=config,
addrs=[connect_config.address], params=connect_config,
config=client_config,
codecs_registry=_CodecsRegistry(),
query_cache=_QueryCodecsCache())
conn.ensure_connected()
Expand Down
Loading

0 comments on commit 085f574

Please sign in to comment.