fix(create_tables): DDL语句分割先剔除注释行——头部注释与首条CREATE粘连导致llm_vendor漏建
This commit is contained in:
parent
252f119f35
commit
464f621f72
@ -350,11 +350,13 @@ async def main():
|
||||
_llm_ddl_path = os.path.join(ROOT_DIR, 'pkgs', 'pipeline-llm', 'mysql.ddl.sql')
|
||||
if os.path.isfile(_llm_ddl_path):
|
||||
with open(_llm_ddl_path, 'r', encoding='utf-8') as _f:
|
||||
_llm_ddl = _f.read()
|
||||
# 先剔除注释行(-- 开头),避免头部注释与首条 CREATE 粘连被整段跳过
|
||||
_llm_ddl = '\n'.join(
|
||||
_l for _l in _f.read().splitlines() if not _l.strip().startswith('--'))
|
||||
_n = 0
|
||||
for _stmt in _llm_ddl.split(';'):
|
||||
_stmt = _stmt.strip()
|
||||
if _stmt and not _stmt.startswith('--'):
|
||||
if _stmt:
|
||||
await sor.execute(_stmt, {})
|
||||
_n += 1
|
||||
print(f' tables: pipeline-llm ensured ({_n} statements, idempotent)')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user