Update docs

This commit is contained in:
Itai Shirav 2018-12-14 08:20:43 +02:00
parent 20ed85c864
commit 374f2dfe3e
3 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,10 @@
Change Log
==========
Unreleased
----------
- Added `timeout` parameter to database initializer (SUHAR1K)
v1.0.3
------
- Bug fix: `QuerySet.count()` ignores slicing

View File

@ -10,7 +10,7 @@ infi.clickhouse_orm.database
Database instances connect to a specific ClickHouse database for running queries,
inserting data and other operations.
#### Database(db_name, db_url="http://localhost:8123/", username=None, password=None, readonly=False, autocreate=True)
#### Database(db_name, db_url="http://localhost:8123/", username=None, password=None, readonly=False, autocreate=True, timeout=60)
Initializes a database instance. Unless it's readonly, the database will be
@ -22,6 +22,7 @@ created on the ClickHouse server if it does not already exist.
- `password`: optional connection credentials.
- `readonly`: use a read-only connection.
- `autocreate`: automatically create the database if does not exist (unless in readonly mode).
- `timeout`: the connection timeout in seconds.
#### add_setting(name, value)

View File

@ -83,8 +83,8 @@ class Database(object):
- `username`: optional connection credentials.
- `password`: optional connection credentials.
- `readonly`: use a read-only connection.
- `autocreate`: automatically create the database if does not exist (unless in readonly mode).
- `timeout`: the connect timeout.
- `autocreate`: automatically create the database if it does not exist (unless in readonly mode).
- `timeout`: the connection timeout in seconds.
'''
self.db_name = db_name
self.db_url = db_url
@ -321,8 +321,7 @@ class Database(object):
if isinstance(data, string_types):
data = data.encode('utf-8')
params = self._build_params(settings)
timeout = self.timeout
r = requests.post(self.db_url, params=params, data=data, stream=stream, timeout=timeout)
r = requests.post(self.db_url, params=params, data=data, stream=stream, timeout=self.timeout)
if r.status_code != 200:
raise ServerError(r.text)
return r