|
@@ -200,12 +200,12 @@ def delete_nonentity_table(db: Session):
|
|
|
.filter(models.DataTable.type == 1).all()
|
|
|
table_ids = []
|
|
|
for data_table in data_tables:
|
|
|
- print(data_table.table_name)
|
|
|
res = hiveDs._execute_sql([f"show tables like '{data_table.table_name}'"])
|
|
|
- print(res)
|
|
|
- if len(res[0][0]) <= 0:
|
|
|
+ if len(res[0]) <= 0:
|
|
|
print(f"{data_table.table_name}不存在,需要删除")
|
|
|
table_ids.append(data_table.id)
|
|
|
res = db.query(models.DataTable).filter(models.DataTable.id.in_(table_ids)).delete()
|
|
|
+ db.commit()
|
|
|
+ db.flush()
|
|
|
print(f"数据湖中不存在的表已清除-->{res}")
|
|
|
return res
|