Skip to content

Commit

Permalink
Version bumped to 0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
xzkostyan committed Oct 12, 2017
1 parent 6c1d6c1 commit a1ecd71
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- Force check clickhouse-cityhash is installed if compression is used.
- `Client` can be directly imported from package.
- `insert_block_size` parameter - maximum rows in block (default is 1048576).
- Columnar data returning (`columnar=True`). Pull request [#11](https://github.com/mymarilyn/clickhouse-driver/pull/11) by [kszucs](https://github.com/kszucs).
- Tunable types check (`types_check=True`). Off by default.

### Changed
- Handling only socket-related errors on ping. Errors are logged with `WARNING` level.
Expand Down
24 changes: 19 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Usage example:

.. code-block:: python
from clickhouse_driver.client import Client
from clickhouse_driver import Client
client = Client('localhost')
Expand Down Expand Up @@ -123,7 +123,7 @@ Data compression:

.. code-block:: python
from clickhouse_driver.client import Client
from clickhouse_driver import Client
client_with_lz4 = Client('localhost', compression=True)
client_with_lz4 = Client('localhost', compression='lz4')
Expand Down Expand Up @@ -178,23 +178,25 @@ hashing algorithm. That's why we can't use original
this algorithm is placed at `PyPi <https://pypi.python.org/pypi/clickhouse-cityhash>`_.


Connection Parameters
---------------------
Client Parameters
-----------------

The first parameter *host* is required. There are some optional parameters:

- *port* is port ClickHouse server is bound to. Default is ``9000``.
- *database* is database connect to. Default is ``'default'``.
- *user*. Default is ``'default'``.
- *password*. Default is ``''`` (no password).
- *client_name*. This name will appear in server logs. Default is ``'pyclient'``.
- *client_name*. This name will appear in server logs. Default is ``'clickhouse-driver'``.
- *compression*. Whether or not use compression. Default is ``False``.Possible choices:

* ``True`` is equivalent to ``'lz4'``.
* ``'lz4'``.
* ``'lz4hc'`` high-compression variant of ``'lz4'``.
* ``'zstd'``.

- *insert_block_size*. Chunk size to split row for ``INSERT``. Default is ``1048576``.


You can also specify timeouts via:

Expand Down Expand Up @@ -223,6 +225,18 @@ Overriding default query settings:
settings = {'max_threads': 2, 'priority': 10}
print(client.execute('SHOW TABLES', settings=settings))
You can retrieve results in columnar form if you need. This is also more faster:

.. code-block:: python
print(client.execute('SELECT arrayJoin(range(3))', columnar=True)
Data types check is disabled for performance on ``INSERT`` queries.
You can turn it on by *types_check* option:
.. code-block:: python
print(client.execute('INSERT INTO test (x) VALUES', [('abc', )], types_check=True))
License
=======
Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .client import Client


VERSION = (0, 0, 6)
VERSION = (0, 0, 7)
__version__ = '.'.join(str(x) for x in VERSION)

__all__ = ['Client']
4 changes: 3 additions & 1 deletion src/columns/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def write_column(column_name, column_spec, items, buf, types_check=False):
except (column_exceptions.StructPackException, OverflowError) as e:
error = e.args[0]
raise errors.TypeMismatchError(
'Type mismatch in VALUES section. Column {}: {}'.format(
'Type mismatch in VALUES section. '
'Repeat query with types_check=True for detailed info. '
'Column {}: {}'.format(
column_name, str(error)
)
)
2 changes: 1 addition & 1 deletion src/defines.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
DEFAULT_INSERT_BLOCK_SIZE = 1048576

DBMS_NAME = 'ClickHouse'
CLIENT_NAME = 'pyclient'
CLIENT_NAME = 'clickhouse-driver'
CLIENT_VERSION = 54276
4 changes: 3 additions & 1 deletion tests/columns/test_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def test_raise_struct_error(self):
'INSERT INTO test (a) VALUES', data
)

self.assertIn('Column a', str(e.exception))
exc = str(e.exception)
self.assertIn('Column a', exc)
self.assertIn('types_check=True', exc)

def test_uint_type_mismatch(self):
data = [(-1, )]
Expand Down

0 comments on commit a1ecd71

Please sign in to comment.