From 6c83641c5a06b61c6d2c19d332866bf7a6eda91c Mon Sep 17 00:00:00 2001 From: Kaleido66 <112840117+Kaleido66@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:06:45 +0800 Subject: [PATCH] fix: Update repo_name.py --- dashboard/repository/scripts/repo_name.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dashboard/repository/scripts/repo_name.py b/dashboard/repository/scripts/repo_name.py index 5454e2f..0dcd144 100644 --- a/dashboard/repository/scripts/repo_name.py +++ b/dashboard/repository/scripts/repo_name.py @@ -1,3 +1,4 @@ +import os import requests import pandas as pd from datetime import datetime @@ -88,19 +89,20 @@ def save_to_clickhouse(client, table_name, df): # Step 3: 连接 ClickHouse 数据库 # 读取数据的 ClickHouse source_client = Client( - host='cc-2ze7189376o5m9759.public.clickhouse.ads.aliyuncs.com', + host=os.environ.get('xlabDB_HOST'), port=9000, - user='xlab', - password='PASSWORD', + user=os.environ.get('xlabDB_USER'), + password=os.environ.get('xlabDB_PASSWORD'), database='opensource', send_receive_timeout=600 ) # 保存数据的 ClickHouse target_client = Client( - host='47.116.118.218', + host=os.environ.get('dashboardDB_HOST'), port=9000, - user='USERS', + user=os.environ.get('dashboardDB_USER'), + password=os.environ.get('dashboardDB_PASSWORD'), database='opensource', send_receive_timeout=600 ) @@ -110,4 +112,4 @@ def save_to_clickhouse(client, table_name, df): # Step 5: 保存结果到 ClickHouse table_name = "platform_project_mapping" - save_to_clickhouse(target_client, table_name, df_result) \ No newline at end of file + save_to_clickhouse(target_client, table_name, df_result)