예제 #1
0
 def test_Configs_bool(self):
     Config.set('test', True)
     print(Config.get('test'))
     self.assertIsInstance(Config.get('test'), bool)
     Config.set('test2', False)
     print(Config.get('test2'))
     self.assertIsInstance(Config.get('test2'), bool)
예제 #2
0
 def test_Configs_int(self):
     Config.set('test', 1)
     print(Config.get('test'))
     self.assertIsInstance(Config.get('test'), int)
예제 #3
0
 def test_Configs_dict(self):
     Config.set('test', {'1': 1, '2': 2})
     print(Config.get('test'))
     self.assertIsInstance(Config.get('test'), (dict, ))
예제 #4
0
 def test_Configs_list(self):
     Config.set('test', ['1', '2'])
     print(Config.get('test'))
     self.assertIsInstance(Config.get('test'), (list, ))
예제 #5
0
 def test_Configs_tuple(self):
     Config.set('test', ('1', '2'))
     print(Config.get('test'))
     self.assertIsInstance(Config.get('test'), (list, ))
예제 #6
0
 def test_Configs_str(self):
     Config.set('test', '1')
     print(Config.get('test'))
     self.assertIsInstance(Config.get('test'), str)
예제 #7
0
import numpy as np
import pandas as pd
import requests

from ClickSQL.conf import Config
from ClickSQL.errors import ParameterKeyError, ParameterTypeError, DatabaseTypeError, DatabaseError, \
    HeartbeatCheckFailure, ClickHouseTableNotExistsError, ServerError
from ClickSQL.utils import cached_property, file_cache, parse_rfc1738_args

"""
this will hold base function of clickhouse and it will apply a path of access clickhouse through clickhouse api service
this scripts will use none of clickhouse client and only depend on requests to make transactions with 
clickhouse-server

"""
if Config.get('ENGAGE_ASYNC', default=False):
    try:
        import nest_asyncio
        nest_asyncio.apply()  # allow run at jupyter and asyncio env
        ENGAGE_ASYNC = True
        from aiohttp import ClientSession
    except Exception as e:
        warnings.warn('Cannot run at jupyter or asyncio env! will use normal version instead!')
        ENGAGE_ASYNC = False
        from requests import Session as ClientSession
else:
    ENGAGE_ASYNC = False
    from requests import Session as ClientSession

node_parameters = ('host', 'port', 'user', 'password', 'database')
node = namedtuple('clickhouse', node_parameters)