分子分母归属月份字段更新
This commit is contained in:
+21
-22
@@ -237,8 +237,8 @@
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-12-25T06:47:43.233398500Z",
|
||||
"start_time": "2025-12-25T06:47:42.837753600Z"
|
||||
"end_time": "2026-01-06T08:14:03.891128500Z",
|
||||
"start_time": "2026-01-06T08:14:03.535415Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
@@ -254,10 +254,10 @@
|
||||
" } # 衡时数据库链接配置-mysql\n",
|
||||
"# table_name = \"new_dealer_service_order_to_bi\" # 替换为你的实际表名\n",
|
||||
"\n",
|
||||
"table_name = \"partner_settlement_to_BI\"\n",
|
||||
"column_name = \"是否同步\"\n",
|
||||
"new_column_type = \"VARCHAR(255)\" # 目标数据类型\n",
|
||||
"# new_column_type = \"DATETIME\" # 目标数据类型\n",
|
||||
"table_name = \"f6_denominator_adjustment\"\n",
|
||||
"column_name = \"归属月份\"\n",
|
||||
"# new_column_type = \"VARCHAR(255)\" # 目标数据类型\n",
|
||||
"new_column_type = \"DATETIME\" # 目标数据类型\n",
|
||||
"\n",
|
||||
"try:\n",
|
||||
" # 连接数据库\n",
|
||||
@@ -316,12 +316,12 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"✅ 成功添加字段: `是否同步`\n",
|
||||
"✅ 成功添加字段: `归属月份`\n",
|
||||
"数据库连接已关闭\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_count": 24
|
||||
"execution_count": 1
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
@@ -421,8 +421,8 @@
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-06-11T01:39:55.579785Z",
|
||||
"start_time": "2025-06-11T01:39:55.295469Z"
|
||||
"end_time": "2026-01-06T08:21:20.943512600Z",
|
||||
"start_time": "2026-01-06T08:21:19.361422Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
@@ -432,10 +432,10 @@
|
||||
"from mysql.connector import Error\n",
|
||||
"\n",
|
||||
"# 数据库连接信息\n",
|
||||
"host = \"rm-uf6r230vbtxf5gdz63o.mysql.rds.aliyuncs.com\"\n",
|
||||
"user = \"rw_operation_data_relay\"\n",
|
||||
"password = \"m+q5Z4%IVuF9bf\"\n",
|
||||
"database = \"f6operation_data_relay\"\n",
|
||||
"BI_CONN_host = \"f6-public.rwlb.rds.aliyuncs.com\"\n",
|
||||
"BI_CONN_INFO_database = \"f6operation_data_relay\"\n",
|
||||
"BI_CONN_INFO_user = \"rw_operation_data_relay\"\n",
|
||||
"BI_CONN_INFO_password = \"m+q5Z4%IVuF9bf\"\n",
|
||||
"table_name = \"yida_process_time_statistics\" # 要操作的表名\n",
|
||||
"# table_name = \"thailand_store_data_email\" # 要操作的表名\n",
|
||||
"min_id_to_delete = 127821 # 要删除的最小ID值\n",
|
||||
@@ -443,20 +443,20 @@
|
||||
"# 连接数据库\n",
|
||||
"try:\n",
|
||||
" connection = mysql.connector.connect(\n",
|
||||
" host=host,\n",
|
||||
" user=user,\n",
|
||||
" password=password,\n",
|
||||
" database=database\n",
|
||||
" host=BI_CONN_host,\n",
|
||||
" user=BI_CONN_INFO_user,\n",
|
||||
" password=BI_CONN_INFO_password,\n",
|
||||
" database=BI_CONN_INFO_database\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
" if connection.is_connected():\n",
|
||||
" cursor = connection.cursor()\n",
|
||||
"\n",
|
||||
" # 使用DELETE删除ID大于等于127821的数据\n",
|
||||
" cursor.execute(f\"DELETE FROM {table_name} WHERE id >= {min_id_to_delete}\")\n",
|
||||
" # cursor.execute(f\"DELETE FROM {table_name} WHERE id >= {min_id_to_delete}\")\n",
|
||||
" cursor.execute(f\"DELETE FROM GP_monthly_renewal_rate_new WHERE 月分区(仅用于存储每月最后一天截至数据) = '202512';\")\n",
|
||||
"\n",
|
||||
" connection.commit()\n",
|
||||
" print(f\"成功删除表 {table_name} 中ID大于等于{min_id_to_delete}的所有数据\")\n",
|
||||
"\n",
|
||||
"except Error as e:\n",
|
||||
" print(f\"删除数据时发生错误: {e}\")\n",
|
||||
@@ -474,12 +474,11 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"成功删除表 yida_process_time_statistics 中ID大于等于127821的所有数据\n",
|
||||
"数据库连接已关闭\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_count": 3
|
||||
"execution_count": 2
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
|
||||
Reference in New Issue
Block a user