mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2025-07-12 17:12:26 +03:00
Added verify_ssl_cert
parameter to database initializer
This commit is contained in:
parent
8c22c753a8
commit
9df82a44ec
|
@ -4,6 +4,7 @@ Change Log
|
||||||
Unreleased
|
Unreleased
|
||||||
----------
|
----------
|
||||||
- Added `timeout` parameter to database initializer (SUHAR1K)
|
- Added `timeout` parameter to database initializer (SUHAR1K)
|
||||||
|
- Added `verify_ssl_cert` parameter to database initializer
|
||||||
- Added `final()` method to querysets (M1hacka)
|
- Added `final()` method to querysets (M1hacka)
|
||||||
|
|
||||||
v1.0.3
|
v1.0.3
|
||||||
|
|
|
@ -10,7 +10,7 @@ infi.clickhouse_orm.database
|
||||||
Database instances connect to a specific ClickHouse database for running queries,
|
Database instances connect to a specific ClickHouse database for running queries,
|
||||||
inserting data and other operations.
|
inserting data and other operations.
|
||||||
|
|
||||||
#### Database(db_name, db_url="http://localhost:8123/", username=None, password=None, readonly=False, autocreate=True, timeout=60)
|
#### Database(db_name, db_url="http://localhost:8123/", username=None, password=None, readonly=False, autocreate=True, timeout=60, verify_ssl_cert=True)
|
||||||
|
|
||||||
|
|
||||||
Initializes a database instance. Unless it's readonly, the database will be
|
Initializes a database instance. Unless it's readonly, the database will be
|
||||||
|
@ -23,6 +23,7 @@ created on the ClickHouse server if it does not already exist.
|
||||||
- `readonly`: use a read-only connection.
|
- `readonly`: use a read-only connection.
|
||||||
- `autocreate`: automatically create the database if it does not exist (unless in readonly mode).
|
- `autocreate`: automatically create the database if it does not exist (unless in readonly mode).
|
||||||
- `timeout`: the connection timeout in seconds.
|
- `timeout`: the connection timeout in seconds.
|
||||||
|
- `verify_ssl_cert`: whether to verify the server's certificate when connecting via HTTPS.
|
||||||
|
|
||||||
|
|
||||||
#### add_setting(name, value)
|
#### add_setting(name, value)
|
||||||
|
|
|
@ -73,7 +73,8 @@ class Database(object):
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, db_name, db_url='http://localhost:8123/',
|
def __init__(self, db_name, db_url='http://localhost:8123/',
|
||||||
username=None, password=None, readonly=False, autocreate=True, timeout=60):
|
username=None, password=None, readonly=False, autocreate=True,
|
||||||
|
timeout=60, verify_ssl_cert=True):
|
||||||
'''
|
'''
|
||||||
Initializes a database instance. Unless it's readonly, the database will be
|
Initializes a database instance. Unless it's readonly, the database will be
|
||||||
created on the ClickHouse server if it does not already exist.
|
created on the ClickHouse server if it does not already exist.
|
||||||
|
@ -85,6 +86,7 @@ class Database(object):
|
||||||
- `readonly`: use a read-only connection.
|
- `readonly`: use a read-only connection.
|
||||||
- `autocreate`: automatically create the database if it does not exist (unless in readonly mode).
|
- `autocreate`: automatically create the database if it does not exist (unless in readonly mode).
|
||||||
- `timeout`: the connection timeout in seconds.
|
- `timeout`: the connection timeout in seconds.
|
||||||
|
- `verify_ssl_cert`: whether to verify the server's certificate when connecting via HTTPS.
|
||||||
'''
|
'''
|
||||||
self.db_name = db_name
|
self.db_name = db_name
|
||||||
self.db_url = db_url
|
self.db_url = db_url
|
||||||
|
@ -93,6 +95,7 @@ class Database(object):
|
||||||
self.readonly = False
|
self.readonly = False
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.request_session = requests.Session()
|
self.request_session = requests.Session()
|
||||||
|
self.request_session.verify = verify_ssl_cert
|
||||||
self.settings = {}
|
self.settings = {}
|
||||||
self.db_exists = False # this is required before running _is_existing_database
|
self.db_exists = False # this is required before running _is_existing_database
|
||||||
self.db_exists = self._is_existing_database()
|
self.db_exists = self._is_existing_database()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user