|
@@ -31,7 +31,8 @@ router = APIRouter(
|
|
|
@sxtimeit
|
|
|
def create_data_management(item: schemas.DataManagementCreate, token_data: schemas.TokenData = Depends(verify_users), db: Session = Depends(get_db)):
|
|
|
current_time = int(time.time())
|
|
|
- table_name = f'project{token_data.project_id.lower()}_user{token_data.user_id.lower()}_{item.name.lower()}_{current_time}'
|
|
|
+ table_name = f'project{token_data.project_id}_user{token_data.user_id}_{item.name}_{current_time}'
|
|
|
+ table_name = table_name.lower()
|
|
|
tmp_table_name = get_tmp_table_name(item.dag_uuid, item.node_id, str(item.out_pin), db)
|
|
|
af_run_res = data_transfer_run(database_name+'.'+tmp_table_name, database_name+'.'+table_name)
|
|
|
af_run = af_run_res['data'] if 'data' in af_run_res.keys() else None
|
|
@@ -66,8 +67,24 @@ def get_data_management_info(id: int, token_data: schemas.TokenData = Depends(ve
|
|
|
transfer_run_status = transfer_run['status'] if transfer_run and 'status' in transfer_run.keys() else None
|
|
|
if transfer_run_status:
|
|
|
item = crud.update_data_management_status(db, item.id, RUN_STATUS[transfer_run_status])
|
|
|
- item.table_name = f'{database_name}.{item.table_name}'
|
|
|
- return item
|
|
|
+ location = ''
|
|
|
+ owner = ''
|
|
|
+ if item.status == 2:
|
|
|
+ res = hiveDs.get_table_info(item.table_name)
|
|
|
+ for line_list in res[0]:
|
|
|
+ if line_list[0].find('Location')>=0:
|
|
|
+ location = line_list[1]
|
|
|
+ if line_list[0].find('Owner')>=0:
|
|
|
+ owner = line_list[1]
|
|
|
+ share_status = crud.check_share(db, item.table_name)
|
|
|
+ item_dict = item.to_dict()
|
|
|
+ item_dict.update({
|
|
|
+ 'table_name': f'{database_name}.{item.table_name}',
|
|
|
+ 'owner': owner,
|
|
|
+ 'location': location,
|
|
|
+ 'share_status': share_status
|
|
|
+ })
|
|
|
+ return item_dict
|
|
|
|
|
|
@router.delete("/")
|
|
|
@web_try()
|