Skip to content

Commit

Permalink
Version bumped to 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
xzkostyan committed Oct 18, 2019
1 parent 05afe9e commit fa9dc20
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 39 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [0.1.2] - 2019-10-18
### Added
- Settings update to 19.16.1 server version. Pull request [#111](https://github.com/mymarilyn/clickhouse-driver/pull/111) by [azat](https://github.com/azat).
- Python 3.8 in Travis CI build matrix.
- Returning inserted rows count on `INSERT` queries with data. Returning rows count from `INSERT FROM SELECT` is not supported.

### Fixed
- Exposing `columnar` parameter to `execute_with_progress`. Pull request [#108](https://github.com/mymarilyn/clickhouse-driver/pull/108) by [igorbb](https://github.com/igorbb).
- LowCardinality tests. Pull request [#112](https://github.com/mymarilyn/clickhouse-driver/pull/112) by [azat](https://github.com/azat).

### Changed
- Increased speed (up to 5 times compared to 0.1.1 release) of `INSERT` queries.
- Date/DateTime columns selecting and inserting optimizations.

## [0.1.1] - 2019-09-20
### Added
- `Client.from_url` method that creates client configured from the given URL.
Expand Down Expand Up @@ -215,8 +229,9 @@
- Date/DateTime types.
- String types.

[Unreleased]: https://github.com/mymarilyn/clickhouse-driver/compare/0.1.1...HEAD
[0.1.1]: https://github.com/mymarilyn/clickhouse-driver/compare/0.1.1...0.1.1
[Unreleased]: https://github.com/mymarilyn/clickhouse-driver/compare/0.1.2...HEAD
[0.1.2]: https://github.com/mymarilyn/clickhouse-driver/compare/0.1.1...0.1.2
[0.1.1]: https://github.com/mymarilyn/clickhouse-driver/compare/0.1.0...0.1.1
[0.1.0]: https://github.com/mymarilyn/clickhouse-driver/compare/0.0.20...0.1.0
[0.0.20]: https://github.com/mymarilyn/clickhouse-driver/compare/0.0.19...0.0.20
[0.0.19]: https://github.com/mymarilyn/clickhouse-driver/compare/0.0.18...0.0.19
Expand Down
2 changes: 1 addition & 1 deletion clickhouse_driver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .client import Client


VERSION = (0, 1, 1)
VERSION = (0, 1, 2)
__version__ = '.'.join(str(x) for x in VERSION)

__all__ = ['Client']
37 changes: 1 addition & 36 deletions docs/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ You can turn it on by `types_check` option:
... 'INSERT INTO test (x) VALUES', [('abc', )],
... types_check=True
... )
1
Query execution statistics
Expand Down Expand Up @@ -245,39 +246,3 @@ Query logs can be received from server by using `send_logs_level` setting:
2018-12-14 10:24:53,875 INFO clickhouse_driver.log: {b328ad33-60e8-4012-b4cc-97f44a7b28f2} [ 25 ] <Information> executeQuery: Read 1 rows, 1.00 B in 0.004 sec., 262 rows/sec., 262.32 B/sec.
2018-12-14 10:24:53,875 INFO clickhouse_driver.log: {b328ad33-60e8-4012-b4cc-97f44a7b28f2} [ 25 ] <Debug> MemoryTracker: Peak memory usage (for query): 40.23 KiB.
[(1,)]
Client configuring from URL
---------------------------

*New in version 0.1.1.*

Client can be configured from the given URL:

.. code-block:: python
>>> from clickhouse_driver import Client
>>> client = Client.from_url(
... 'clickhouse://login:password@host:port/database'
... )
Port 9000 is default for schema ``clickhouse``, port 9440 is default for schema ``clickhouses``.

Connection to default database:

.. code-block:: python
>>> client = Client.from_url('clickhouse://localhost')
Querystring arguments will be passed along to the :meth:`~clickhouse_driver.connection.Connection` class’s initializer:

.. code-block:: python
>>> client = Client.from_url(
... 'clickhouse://localhost/database?send_logs_level=trace&'
... 'client_name=myclient&'
... 'compression=lz4'
... )
If parameter doesn't match Connection's init signature will be treated as settings parameter.
38 changes: 38 additions & 0 deletions docs/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@
Miscellaneous
=============

Client configuring from URL
---------------------------

*New in version 0.1.1.*

Client can be configured from the given URL:

.. code-block:: python
>>> from clickhouse_driver import Client
>>> client = Client.from_url(
... 'clickhouse://login:password@host:port/database'
... )
Port 9000 is default for schema ``clickhouse``, port 9440 is default for schema ``clickhouses``.

Connection to default database:

.. code-block:: python
>>> client = Client.from_url('clickhouse://localhost')
Querystring arguments will be passed along to the :meth:`~clickhouse_driver.connection.Connection` class’s initializer:

.. code-block:: python
>>> client = Client.from_url(
... 'clickhouse://localhost/database?send_logs_level=trace&'
... 'client_name=myclient&'
... 'compression=lz4'
... )
If parameter doesn't match Connection's init signature will be treated as settings parameter.


Inserting data from CSV file
----------------------------

Expand Down Expand Up @@ -49,6 +85,8 @@ Data can be inserted into ClickHouse in the following way:
... )
>>> []
>>> client.execute('INSERT INTO data_csv VALUES', iter_csv('/tmp/data.csv'))
3
Table can be populated with json file in the similar way.
Expand Down
6 changes: 6 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ There are two conceptual types of queries:
Every query should be executed by calling one of the client's execute
methods: `execute`, `execute_with_progress`, `execute_iter method`.

- SELECT queries can use `execute`, `execute_with_progress`, `execute_iter`
methods.
- INSERT queries can use only `execute` method.

Selecting data
--------------
Expand Down Expand Up @@ -139,14 +142,17 @@ To insert data efficiently, provide data separately, and end your statement with
... 'INSERT INTO test (x) VALUES',
... [{'x': 1}, {'x': 2}, {'x': 3}, {'x': 100}]
... )
4
>>> client.execute(
... 'INSERT INTO test (x) VALUES',
... [[200]]
... )
1
>>> client.execute(
... 'INSERT INTO test (x) VALUES',
... ((x, ) for x in range(5))
... )
5
You can use any iterable yielding lists, tuples or dicts.

Expand Down
6 changes: 6 additions & 0 deletions docs/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ SELECT type: :class:`~datetime.datetime`.

Setting `use_client_time_zone <https://clickhouse.yandex/docs/en/single/#datetime>`_ is taken into consideration.

You can cast DateTime column to integers if you are facing performance issues when selecting large amount of rows.


String/FixedString(N)
---------------------
Expand Down Expand Up @@ -103,6 +105,7 @@ SELECT type: :class:`str`/:func:`basestring <basestring>`.
... 'INSERT INTO test (x) VALUES',
... [{'x': MyEnum.foo}, {'x': 'bar'}, {'x': 1}]
... )
3
>>> client.execute('SELECT * FROM test')
[('foo',), ('bar',), ('foo',)]
Expand Down Expand Up @@ -136,6 +139,7 @@ SELECT type: :func:`tuple <tuple>`.
... 'INSERT INTO test (x) VALUES',
... [{'x': [10, 20, 30]}, {'x': [11, 21, 31]}]
... )
2
>>> client.execute('SELECT * FROM test')
[((10, 20, 30),), ((11, 21, 31),)]
Expand Down Expand Up @@ -192,6 +196,7 @@ SELECT type: :class:`~ipaddress.IPv4Address`/:class:`~ipaddress.IPv6Address`.
... {'x': 167772161},
... {'x': IPv4Address('192.168.253.42')}
... ])
3
>>> client.execute('SELECT * FROM test')
[(IPv4Address('192.168.253.42'),), (IPv4Address('10.0.0.1'),), (IPv4Address('192.168.253.42'),)]
>>>
Expand All @@ -208,6 +213,7 @@ SELECT type: :class:`~ipaddress.IPv4Address`/:class:`~ipaddress.IPv6Address`.
... {'x': IPv6Address('12ff:0000:0000:0000:0000:0000:0000:0001')},
... {'x': b"y\xf4\xe6\x98E\xde\xa5\x9b'e(\xe3\x8d:5\xae"}
... ])
3
>>> client.execute('SELECT * FROM test')
[(IPv6Address('79f4:e698:45de:a59b:2765:28e3:8d3a:35ae'),), (IPv6Address('12ff::1'),), (IPv6Address('79f4:e698:45de:a59b:2765:28e3:8d3a:35ae'),)]
>>>
Expand Down

0 comments on commit fa9dc20

Please sign in to comment.