def counter_statistics(): storeservice = MysqlService() index = 0 to_table = 234 try: for index in range(1, 250, 1): logger.info('addressing {0} ....'.format(index)) # step 1: fetch one code sql = 'select count(code) from ft_1M_{0}'.format(index) result = storeservice.executeSql(sql) print(result.cursor._result.rows[0]) except Exception as err: logger.info(err)
def main(): storeservice = MysqlService() kline_tables_number = 12 kline_5M_tables_number = 35 kline_1M_tables_number = 171 for index in range(1,kline_tables_number,1): sql = 'INSERT INTO sys_sharding(code, dtype, tindex) SELECT code, \'hk\' as dtype, {0} as tindex from (SELECT DISTINCT(code) FROM ft_kline_{1}) as tmp1'.format(index,index) storeservice.executeSql(sql) for index in range(1,kline_5M_tables_number,1): sql = 'INSERT INTO sys_sharding(code, dtype, tindex) SELECT code, \'hk_5m\' as dtype, {0} as tindex from (SELECT DISTINCT(code) FROM ft_5M_{1}) as tmp1'.format(index,index) storeservice.executeSql(sql) for index in range(1,kline_1M_tables_number,1): sql = 'INSERT INTO sys_sharding(code, dtype, tindex) SELECT code, \'hk_1m\' as dtype, {0} as tindex from (SELECT DISTINCT(code) FROM ft_1M_{1}) as tmp1'.format(index,index) storeservice.executeSql(sql)