From f7df419e21f06440fa0b53eeba34df1b18b4a7cf Mon Sep 17 00:00:00 2001 From: Indiem87 Date: Mon, 16 Mar 2026 01:15:07 -0400 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20ETL=20=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=EF=BC=9A=E5=AF=BC=E5=87=BA=E5=B9=B6=E4=B8=B0=E5=AF=8C=20loops?= =?UTF-8?q?=20=E6=95=B0=E6=8D=AE=EF=BC=88=E4=BA=A4=E4=BA=92=E5=BC=8F?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E8=BE=93=E5=85=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 提取 SOURCE 库中 loops 表中 type 为 '0'/'1' 的行,联表补全酒店与房型名称,创建目标 schema/table 并写入到 TARGET 库。 - 使用 SQLAlchemy + pandas 实现;支持通过环境变量配置连接信息,包含用于创建目标表的 create_target_table 函数和用于构建连接 URL 的 build_url 函数。 - 脚本会在目标库创建 schema(若不存在)并重建目标表。 - 依赖: pandas, sqlalchemy, psycopg2。 --- database_test_project/test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/database_test_project/test.py b/database_test_project/test.py index 48b9b6c..c89ae82 100644 --- a/database_test_project/test.py +++ b/database_test_project/test.py @@ -5,6 +5,7 @@ import pandas as pd from sqlalchemy import create_engine, text + def build_url(prefix: str) -> str: user = os.getenv(f"{prefix}_PG_USER", "log_admin") password = os.getenv(f"{prefix}_PG_PASSWORD")