mirror of
https://github.com/hanzo-ds/connect.git
synced 2026-10-30 20:31:24 +00:00
* refactor(driver): accept None for port and database as canonical 'not specified' * docs: track internal driver signature default change * keep legacy port and database sentinels working * allow trailing slash --------- Co-authored-by: Joe S <[email protected]>
32 lines
750 B
Python
32 lines
750 B
Python
from typing import Any
|
|
|
|
from clickhouse_connect.dbapi.connection import Connection
|
|
|
|
apilevel = "2.0" # PEP 249 DB API level
|
|
threadsafety = 2 # PEP 249 Threads may share the module and connections.
|
|
paramstyle = "pyformat" # PEP 249 Python extended format codes, e.g. ...WHERE name=%(name)s
|
|
|
|
|
|
class Error(Exception):
|
|
pass
|
|
|
|
|
|
def connect(
|
|
host: str | None = None,
|
|
database: str | None = None,
|
|
username: str = "",
|
|
password: str = "",
|
|
port: int | None = None,
|
|
**kwargs: Any,
|
|
) -> Connection:
|
|
secure = kwargs.pop("secure", False)
|
|
return Connection(
|
|
host=host,
|
|
database=database,
|
|
username=username,
|
|
password=password,
|
|
port=port,
|
|
secure=secure,
|
|
**kwargs,
|
|
)
|