mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-22 00:56:34 +03:00
Move database creation into a separate method
This commit is contained in:
parent
48d7dfe661
commit
cce85beeef
|
@ -25,7 +25,13 @@ class Database(object):
|
|||
self.password = password
|
||||
self.readonly = readonly
|
||||
if not self.readonly:
|
||||
self._send('CREATE DATABASE IF NOT EXISTS `%s`' % db_name)
|
||||
self.create_database()
|
||||
|
||||
def create_database(self):
|
||||
self._send('CREATE DATABASE IF NOT EXISTS `%s`' % self.db_name)
|
||||
|
||||
def drop_database(self):
|
||||
self._send('DROP DATABASE `%s`' % self.db_name)
|
||||
|
||||
def create_table(self, model_class):
|
||||
# TODO check that model has an engine
|
||||
|
@ -34,9 +40,6 @@ class Database(object):
|
|||
def drop_table(self, model_class):
|
||||
self._send(model_class.drop_table_sql(self.db_name))
|
||||
|
||||
def drop_database(self):
|
||||
self._send('DROP DATABASE `%s`' % self.db_name)
|
||||
|
||||
def insert(self, model_instances, batch_size=1000):
|
||||
from six import next
|
||||
i = iter(model_instances)
|
||||
|
|
Loading…
Reference in New Issue
Block a user