def __init__(self, backend, *args, **kwargs): self.database_class = backend.database_class self.query_class = backend.query_class self.dialect = backend.dialect self.table_class = backend.table_class self.table_expr_class = backend.table_expr_class self.con = _DriverClient(*args, **kwargs)
def do_connect( self, host='localhost', port=9000, database='default', user='******', password='', client_name='ibis', compression=_default_compression, ): """Create an ClickhouseClient for use with Ibis. Parameters ---------- host : str, optional Host name of the clickhouse server port : int, optional Clickhouse server's port database : str, optional Default database when executing queries user : str, optional User to authenticate with password : str, optional Password to authenticate with client_name: str, optional This will appear in clickhouse server logs compression: str, optional Weather or not to use compression. Default is lz4 if installed else False. Possible choices: lz4, lz4hc, quicklz, zstd, True, False True is equivalent to 'lz4'. Examples -------- >>> import ibis >>> import os >>> clickhouse_host = os.environ.get('IBIS_TEST_CLICKHOUSE_HOST', ... 'localhost') >>> clickhouse_port = int(os.environ.get('IBIS_TEST_CLICKHOUSE_PORT', ... 9000)) >>> client = ibis.clickhouse.connect( ... host=clickhouse_host, ... port=clickhouse_port ... ) >>> client # doctest: +ELLIPSIS <ibis.clickhouse.client.ClickhouseClient object at 0x...> Returns ------- ClickhouseClient """ self.con = _DriverClient( host=host, port=port, database=database, user=user, password=password, client_name=client_name, compression=compression, )
def do_connect( self, host: str = "localhost", port: int = 9000, database: str = "default", user: str = "default", password: str = "", client_name: str = "ibis", compression: ( Literal["lz4", "lz4hc", "quicklz", "zstd"] | bool ) = _default_compression, ): """Create a ClickHouse client for use with Ibis. Parameters ---------- host Host name of the clickhouse server port Clickhouse server's port database Default database when executing queries user User to authenticate with password Password to authenticate with client_name Name of client that wil appear in clickhouse server logs compression Whether or not to use compression. Default is `'lz4'` if installed else False. True is equivalent to `'lz4'`. Examples -------- >>> import ibis >>> import os >>> clickhouse_host = os.environ.get('IBIS_TEST_CLICKHOUSE_HOST', 'localhost') >>> clickhouse_port = int(os.environ.get('IBIS_TEST_CLICKHOUSE_PORT', 9000)) >>> client = ibis.clickhouse.connect(host=clickhouse_host, port=clickhouse_port) >>> client # doctest: +ELLIPSIS <ibis.clickhouse.client.ClickhouseClient object at 0x...> """ # noqa: E501 self.con = _DriverClient( host=host, port=port, database=database, user=user, password=password, client_name=client_name, compression=compression, )
def __init__(self, *args, **kwargs): self.con = _DriverClient(*args, **kwargs)