Browse Source

增加库名

liweiquan 2 years ago
parent
commit
405fe542d1
2 changed files with 4 additions and 5 deletions
  1. 2 2
      app/services/dag.py
  2. 2 3
      app/services/jm_job.py

+ 2 - 2
app/services/dag.py

@@ -122,7 +122,7 @@ def get_tmp_table_name(dag_uuid: str, node_id: str, out_pin: str, db: Session):
             task_id = t_id
             break
     if task_id:
-        table_name = f'`{database_name}`.`job{job_id}_task{task_id}_subnode{node_id}_output{out_pin}_tmp`'
+        table_name = f'{database_name}.job{job_id}_task{task_id}_subnode{node_id}_output{out_pin}_tmp'
         t_list = hiveDs.list_tables()
         if table_name.lower() not in t_list:
             raise Exception('该节点不存在中间结果')
@@ -132,4 +132,4 @@ def get_tmp_table_name(dag_uuid: str, node_id: str, out_pin: str, db: Session):
 
 def get_transfer_table_name(project_id: str, user_id: str, name: str, ):
     current_time = int(time.time())
-    return f'`{database_name}`.`project{project_id.lower()}_user{user_id.lower()}_{name.lower()}_{current_time}`'
+    return f'{database_name}.project{project_id.lower()}_user{user_id.lower()}_{name.lower()}_{current_time}'

+ 2 - 3
app/services/jm_job.py

@@ -160,7 +160,7 @@ def red_dag_and_format(jm_homework: models.JmHomework, db: Session):
                 script += filed['dataField'] + ','
             script = script.strip(',')
             data_source = crud.get_job_jdbc_datasource(db,node_relation_dict[node['id']].datasource_id)
-            script += ' from ' + '`' + data_source.database_name + '`.`'+node_relation_dict[node['id']].table+'`'
+            script += ' from ' + data_source.database_name + '.'+node_relation_dict[node['id']].table+''
             sub_node = {
                 "id": node['id'],
                 "name": node['name'],
@@ -171,9 +171,8 @@ def red_dag_and_format(jm_homework: models.JmHomework, db: Session):
         elif node['op'] == 'outputsource':
             fileds = node['data']['output_source']
             data_source = crud.get_job_jdbc_datasource(db,node_relation_dict[node['id']].datasource_id)
-            script += ' from ' + '`' + data_source.database_name + '`.`'+node_relation_dict[node['id']].table+'`'
             script = '''def main_func (input0, spark,sc):
-    input0.write.mode("overwrite").saveAsTable("'''+'`' + data_source.database_name + '`.`'+node_relation_dict[node['id']].table+'`'+'''")'''
+    input0.write.mode("overwrite").saveAsTable("''' + data_source.database_name + '.'+node_relation_dict[node['id']].table+'''")'''
             inputs = {}
             index = 0
             input_list = t_s[node['id']] if node['id'] in t_s.keys() else []