diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-14 07:46:20 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-14 07:57:41 +0300 |
commit | 81e1d6f415394fe9838dbfcf6222d2436cf8b6be (patch) | |
tree | c339eaafb3902cbc4cb962d9025926175533f91c | |
parent | 2f610d6cc78cd1a5bbf8cf3b547562de8c02696c (diff) | |
download | ydb-81e1d6f415394fe9838dbfcf6222d2436cf8b6be.tar.gz |
Intermediate changes
7 files changed, 21 insertions, 15 deletions
diff --git a/contrib/python/clickhouse-connect/.dist-info/METADATA b/contrib/python/clickhouse-connect/.dist-info/METADATA index 59c9d0db25..bb7d4b45cd 100644 --- a/contrib/python/clickhouse-connect/.dist-info/METADATA +++ b/contrib/python/clickhouse-connect/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: clickhouse-connect -Version: 0.7.0 +Version: 0.7.1 Summary: ClickHouse Database Core Driver for Python, Pandas, and Superset Home-page: https://github.com/ClickHouse/clickhouse-connect Author: ClickHouse Inc. @@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Requires-Python: ~=3.8 Description-Content-Type: text/markdown License-File: LICENSE diff --git a/contrib/python/clickhouse-connect/LICENSE b/contrib/python/clickhouse-connect/LICENSE index 31495aae11..1ac8466cc9 100644 --- a/contrib/python/clickhouse-connect/LICENSE +++ b/contrib/python/clickhouse-connect/LICENSE @@ -1,4 +1,4 @@ -Copyright 2022-2023 ClickHouse, Inc. +Copyright 2022-2024 ClickHouse, Inc. Apache License Version 2.0, January 2004 diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py index 861cc50299..104c9df52f 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py @@ -1 +1 @@ -version = '0.7.0' +version = '0.7.1' diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py index beaea8e0d1..e91e0baf53 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py @@ -157,7 +157,7 @@ class Client(ABC): # pylint: disable=too-many-arguments,unused-argument,too-many-locals def query(self, - query: str = None, + query: Optional[str] = None, parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, settings: Optional[Dict[str, Any]] = None, query_formats: Optional[Dict[str, str]] = None, @@ -193,7 +193,7 @@ class Client(ABC): return self._query_with_context(query_context) def query_column_block_stream(self, - query: str = None, + query: Optional[str] = None, parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, settings: Optional[Dict[str, Any]] = None, query_formats: Optional[Dict[str, str]] = None, @@ -212,7 +212,7 @@ class Client(ABC): return self._context_query(locals(), use_numpy=False, streaming=True).column_block_stream def query_row_block_stream(self, - query: str = None, + query: Optional[str] = None, parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, settings: Optional[Dict[str, Any]] = None, query_formats: Optional[Dict[str, str]] = None, @@ -231,7 +231,7 @@ class Client(ABC): return self._context_query(locals(), use_numpy=False, streaming=True).row_block_stream def query_rows_stream(self, - query: str = None, + query: Optional[str] = None, parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, settings: Optional[Dict[str, Any]] = None, query_formats: Optional[Dict[str, str]] = None, @@ -270,7 +270,7 @@ class Client(ABC): # pylint: disable=duplicate-code,too-many-arguments,unused-argument def query_np(self, - query: str = None, + query: Optional[str] = None, parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, settings: Optional[Dict[str, Any]] = None, query_formats: Optional[Dict[str, str]] = None, @@ -289,7 +289,7 @@ class Client(ABC): # pylint: disable=duplicate-code,too-many-arguments,unused-argument def query_np_stream(self, - query: str = None, + query: Optional[str] = None, parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, settings: Optional[Dict[str, Any]] = None, query_formats: Optional[Dict[str, str]] = None, @@ -308,7 +308,7 @@ class Client(ABC): # pylint: disable=duplicate-code,too-many-arguments,unused-argument def query_df(self, - query: str = None, + query: Optional[str] = None, parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, settings: Optional[Dict[str, Any]] = None, query_formats: Optional[Dict[str, str]] = None, @@ -331,7 +331,7 @@ class Client(ABC): # pylint: disable=duplicate-code,too-many-arguments,unused-argument def query_df_stream(self, - query: str = None, + query: Optional[str] = None, parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, settings: Optional[Dict[str, Any]] = None, query_formats: Optional[Dict[str, str]] = None, @@ -355,7 +355,7 @@ class Client(ABC): streaming=True).df_stream def create_query_context(self, - query: str = None, + query: Optional[str] = None, parameters: Optional[Union[Sequence, Dict[str, Any]]] = None, settings: Optional[Dict[str, Any]] = None, query_formats: Optional[Dict[str, str]] = None, diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py index 7d72b95aa3..c4a2da2393 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py @@ -171,7 +171,7 @@ class HttpClient(Client): final_query = super()._prep_query(context) if context.is_insert: return final_query - return f'{final_query}\n FORMAT {self._write_format}' + return f'{final_query}\n FORMAT {self._read_format}' def _query_with_context(self, context: QueryContext) -> QueryResult: headers = {} diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/tools.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/tools.py index 420686cd64..54b4b45949 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/tools.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/tools.py @@ -13,7 +13,12 @@ def insert_file(client: Client, database: Optional[str] = None, settings: Optional[Dict[str, Any]] = None, compression: Optional[str] = None) -> QuerySummary: - full_table = f'{quote_identifier(database)}.{quote_identifier(table)}' if database else quote_identifier(table) + if not database and table[0] not in ('`', "'") and table.find('.') > 0: + full_table = table + elif database: + full_table = f'{quote_identifier(database)}.{quote_identifier(table)}' + else: + full_table = quote_identifier(table) if not fmt: fmt = 'CSV' if column_names else 'CSVWithNames' if compression is None: diff --git a/contrib/python/clickhouse-connect/ya.make b/contrib/python/clickhouse-connect/ya.make index 7db828de23..1bb663cb9b 100644 --- a/contrib/python/clickhouse-connect/ya.make +++ b/contrib/python/clickhouse-connect/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.7.0) +VERSION(0.7.1) LICENSE(Apache-2.0) |