From 793726adb2a056ae018919544db444088ef9a611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=BE=D0=BD=D0=B0=D1=80=D0=B5=D0=B2=D1=81=D0=BA?= =?UTF-8?q?=D0=B8=D0=B9=20=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80?= Date: Tue, 8 May 2018 16:41:50 +0300 Subject: [PATCH] Fix after review --- src/infi/clickhouse_orm/database.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/infi/clickhouse_orm/database.py b/src/infi/clickhouse_orm/database.py index aeb7cf7..a4bb936 100644 --- a/src/infi/clickhouse_orm/database.py +++ b/src/infi/clickhouse_orm/database.py @@ -72,8 +72,7 @@ class Database(object): ''' def __init__(self, db_name, db_url='http://localhost:8123/', - username=None, password=None, readonly=False, autocreate=True, - get_timezone=True): + username=None, password=None, readonly=False, autocreate=True): ''' Initializes a database instance. Unless it's readonly, the database will be created on the ClickHouse server if it does not already exist. @@ -84,7 +83,6 @@ class Database(object): - `password`: optional connection credentials. - `readonly`: use a read-only connection. - `autocreate`: automatically create the database if does not exist (unless in readonly mode). - - `get_timezone`: automatically detect the server timezone. ''' self.db_name = db_name self.db_url = db_url @@ -98,9 +96,9 @@ class Database(object): elif autocreate: self.db_exists = False self.create_database() - - self.server_timezone = self._get_server_timezone() if get_timezone else pytz.utc self.server_version = self._get_server_version() + # Versions 1.1.53981 and below don't have timezone function + self.server_timezone = self._get_server_timezone() if self.server_version[2] > 53981 else pytz.utc def create_database(self): '''