Commit 07b63e1b 07b63e1b50218c2e4c7b02f2d70cc3ffeb61abd3 by 沈秋雨

feat(etl_to_crawler): 在歌曲记录处理中添加平台字段

- 在runner.py中将platform字段添加至初始数据字典
- 在writer.py中修改SQL语句以插入platform信息
- 更新批量插入参数,包含platform字段
- 保持原有冲突处理逻辑不变,防止重复插入
1 parent f49c0c2c
......@@ -453,6 +453,7 @@ def initialize_yinyan_song_records(platforms: list[str], max_batches: int | None
init_rows.append({
'song_id': src_id,
'record_id': int(primary_record['record_id']),
'platform': primary_record['platform'],
})
if init_rows:
......
......@@ -7,11 +7,11 @@ def insert_yinyan_song_records(cur, records: list[dict]) -> None:
return
cur.executemany(
"""
INSERT INTO yinyan_song_records (song_id, record_id, is_yinyan_push)
VALUES (%s, %s, FALSE)
INSERT INTO yinyan_song_records (song_id, record_id, platform, is_yinyan_push)
VALUES (%s, %s, %s, FALSE)
ON CONFLICT (song_id, record_id) DO NOTHING
""",
[(r['song_id'], r['record_id']) for r in records],
[(r['song_id'], r['record_id'], r['platform']) for r in records],
)
......