提交 5a73a986 编写于 作者: A alesapin

Remove pymongo

上级 2bb54b0b
# -*- coding: utf-8 -*-
import warnings
import pymysql.cursors
import pymongo
#import pymongo
import os
......@@ -123,40 +123,40 @@ class SourceMySQL(ExternalSource):
self.execute_mysql_query(query)
class SourceMongo(ExternalSource):
def get_source_str(self, table_name):
return '''
<mongodb>
<host>{host}</host>
<port>{port}</port>
<user>{user}</user>
<password>{password}</password>
<db>test</db>
<collection>{tbl}</collection>
</mongodb>
'''.format(
host=self.docker_hostname,
port=self.docker_port,
user=self.user,
password=self.password,
tbl=table_name,
)
def prepare(self, structure, table_name, cluster):
connection_str = 'mongodb://{user}:{password}@{host}:{port}'.format(
host=self.internal_hostname, port=self.internal_port,
user=self.user, password=self.password)
self.connection = pymongo.MongoClient(connection_str)
self.connection.create
self.structure = structure
self.db = self.connection['test']
self.prepared = True
def load_data(self, data, table_name):
tbl = self.db[table_name]
to_insert = [dict(row.data) for row in data]
result = tbl.insert_many(to_insert)
#class SourceMongo(ExternalSource):
#
# def get_source_str(self, table_name):
# return '''
# <mongodb>
# <host>{host}</host>
# <port>{port}</port>
# <user>{user}</user>
# <password>{password}</password>
# <db>test</db>
# <collection>{tbl}</collection>
# </mongodb>
# '''.format(
# host=self.docker_hostname,
# port=self.docker_port,
# user=self.user,
# password=self.password,
# tbl=table_name,
# )
#
# def prepare(self, structure, table_name, cluster):
# connection_str = 'mongodb://{user}:{password}@{host}:{port}'.format(
# host=self.internal_hostname, port=self.internal_port,
# user=self.user, password=self.password)
# self.connection = pymongo.MongoClient(connection_str)
# self.connection.create
# self.structure = structure
# self.db = self.connection['test']
# self.prepared = True
#
# def load_data(self, data, table_name):
# tbl = self.db[table_name]
# to_insert = [dict(row.data) for row in data]
# result = tbl.insert_many(to_insert)
class SourceClickHouse(ExternalSource):
......
......@@ -151,6 +151,7 @@ def test_simple_dictionaries(started_cluster):
dct.load_data(data)
node.query("system reload dictionaries")
queries_with_answers = []
for dct in simple_dicts:
for row in data:
......@@ -183,6 +184,7 @@ def test_complex_dictionaries(started_cluster):
dct.load_data(data)
node.query("system reload dictionaries")
queries_with_answers = []
for dct in complex_dicts:
for row in data:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册