目录
一、MySQL工具类
二、MongoDB工具类
三、数据同步实现代码
一、MySQL工具类
# -*- encoding: utf-8 -*-
import pymysql
class MySQLUtil...import MySQLUtil
class SyncMysqlMongo:
"""
mysql同步数据到MongoDB
"""
def __init__(self,...)
def mysqlToMongo(self, mysql_database, mysql_table, mongo_collect_name):
"""将一张MySQL表数据全量插入到...= "127.0.0.1", "xl01"
## 数据库同步对象
syncsql = SyncMysqlMongo(mysql_ip, mysql_user, mysql_passwd..., mysql_db, mongo_ip, mongo_db)
## 将一张MySQL表数据全量插入到MongoDB集合中
mysql_database, mysql_table = "