|
|
|
|
|
import transferIndustrySatistics_python as tis
|
|
|
|
|
|
import transferData_python as td
|
|
|
|
|
|
import transferIndustryData_python as tid
|
|
|
|
|
|
import transferNewrecordData_python as tnd
|
|
|
|
|
|
import transferOhterRyData_python as trd
|
|
|
|
|
|
import pymysql
|
|
|
|
|
|
|
|
|
|
|
|
def main() :
|
|
|
|
|
|
# 数据库A的连接信息;腾讯云数据库
|
|
|
|
|
|
db_a_config = {
|
|
|
|
|
|
'host': '124.223.98.178',
|
|
|
|
|
|
'user': 'root',
|
|
|
|
|
|
'password': '1qazse42W3',
|
|
|
|
|
|
'db': 'ry',
|
|
|
|
|
|
'charset': 'utf8mb4',
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# 数据库B的连接信息;腾讯云数据库
|
|
|
|
|
|
db_b_config = {
|
|
|
|
|
|
'host': '124.223.98.178',
|
|
|
|
|
|
'user': 'root',
|
|
|
|
|
|
'password': '1qazse42W3',
|
|
|
|
|
|
'db': 'mojin',
|
|
|
|
|
|
'charset': 'utf8mb4',
|
|
|
|
|
|
}
|
|
|
|
|
|
try:
|
|
|
|
|
|
# 连接数据库A
|
|
|
|
|
|
db_a_conn = pymysql.connect(**db_a_config)
|
|
|
|
|
|
db_a_cursor = db_a_conn.cursor()
|
|
|
|
|
|
|
|
|
|
|
|
# 连接数据库B
|
|
|
|
|
|
db_b_conn = pymysql.connect(**db_b_config)
|
|
|
|
|
|
db_b_cursor = db_b_conn.cursor()
|
|
|
|
|
|
|
|
|
|
|
|
trade_date = '2023-08-09'
|
|
|
|
|
|
|
|
|
|
|
|
#传输ry库其他数据
|
|
|
|
|
|
trd.toTransRyOhterData(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_date)
|
|
|
|
|
|
|
|
|
|
|
|
#转换数据
|
|
|
|
|
|
td.toTransData(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_date)
|
|
|
|
|
|
|
|
|
|
|
|
#转换新高数据
|
|
|
|
|
|
tnd.toTransNewRecordData(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_date)
|
|
|
|
|
|
|
|
|
|
|
|
#转换版块数据
|
|
|
|
|
|
tid.toTransIndustryData(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_date)
|
|
|
|
|
|
|
|
|
|
|
|
# 转换分析数据
|
|
|
|
|
|
tis.toTransIndustrySatisticsData(db_a_conn,db_a_cursor,db_b_conn,db_b_cursor,trade_date)
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
print(f"出现错误:{e}")
|
|
|
|
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
|
# 关闭连接
|
|
|
|
|
|
if db_a_cursor:
|
|
|
|
|
|
db_a_cursor.close()
|
|
|
|
|
|
if db_a_conn:
|
|
|
|
|
|
db_a_conn.close()
|
|
|
|
|
|
|
|
|
|
|
|
if db_b_cursor:
|
|
|
|
|
|
db_b_cursor.close()
|
|
|
|
|
|
if db_b_conn:
|
|
|
|
|
|
db_b_conn.close()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
main()
|