mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-25 02:03:46 +03:00
Fixing Database class to allow readonly mode
This commit is contained in:
parent
982b87dd1c
commit
c492d419cc
|
@ -18,12 +18,14 @@ class DatabaseException(Exception):
|
|||
|
||||
class Database(object):
|
||||
|
||||
def __init__(self, db_name, db_url='http://localhost:8123/', username=None, password=None):
|
||||
def __init__(self, db_name, db_url='http://localhost:8123/', username=None, password=None, readonly=False):
|
||||
self.db_name = db_name
|
||||
self.db_url = db_url
|
||||
self.username = username
|
||||
self.password = password
|
||||
self._send('CREATE DATABASE IF NOT EXISTS `%s`' % db_name)
|
||||
self.readonly = readonly
|
||||
if not self.readonly:
|
||||
self._send('CREATE DATABASE IF NOT EXISTS `%s`' % db_name)
|
||||
|
||||
def create_table(self, model_class):
|
||||
# TODO check that model has an engine
|
||||
|
|
Loading…
Reference in New Issue
Block a user