Files
d19ef5e0be refactor(driver): accept None for port and database as 'not specified' (#813)
* 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]>
2026-06-23 15:27:25 -07:00

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,
)