|
@@ -6,10 +6,13 @@ from app import models, schemas
|
|
|
from sqlalchemy.orm import Session
|
|
|
from app.common.hive import hiveDs
|
|
|
from configs.globals import g
|
|
|
+from configs.settings import DefaultOption, config
|
|
|
+database_name = config.get('HIVE', 'DATABASE_NAME')
|
|
|
|
|
|
def import_datalake(db: Session, item: schemas.ImportDataLake):
|
|
|
# 校验数据湖中是否存在此库表
|
|
|
ailab_table_names = hiveDs.list_tables()
|
|
|
+ if not item.database_name == database_name: raise Exception(f'数据湖中不存在库{item.database_name}')
|
|
|
if not item.table_name in ailab_table_names: raise Exception(f'数据湖中不存在表{item.table_name}')
|
|
|
data_table = models.DataTable(**{
|
|
|
'database_name': item.database_name,
|