diff --git a/tests/logictest/clickhouse_connector.py b/tests/logictest/clickhouse_connector.py index 5e36d1c745328..77beffd97261e 100644 --- a/tests/logictest/clickhouse_connector.py +++ b/tests/logictest/clickhouse_connector.py @@ -25,8 +25,7 @@ def connect(self, headers = e.dict("CLICKHOUSE_ADDITIONAL_HEADERS") for key in headers: self._additonal_headers["header__" + key] = headers[key] - self._engine = create_engine(self._uri, - connect_args=self._additonal_headers) + self._session = None def query_with_session(self, statement): @@ -45,7 +44,8 @@ def parseSQL(sql): return sql # do nothing if self._session is None: - self._session = make_session(self._engine) + engine = create_engine(self._uri, connect_args=self._additonal_headers) + self._session = make_session(engine) log.debug(parseSQL(statement)) return self._session.execute(parseSQL(statement))