|
|
@@ -198,13 +198,24 @@ class Submission(object):
|
|
|
|
|
|
self.job.override_subworkflow_id(action, workflow.id) # For displaying the correct graph
|
|
|
self.properties['workspace_%s' % workflow.uuid] = workspace # For pointing to the correct workspace
|
|
|
+
|
|
|
elif action.data['type'] == 'hive-document' or action.data['type'] == 'hive2':
|
|
|
- if action.data['type'] == 'hive-document' and action.data['properties'].get('uuid'):
|
|
|
- from notebook.models import Notebook
|
|
|
+ from notebook.models import Notebook
|
|
|
+ if action.data['properties'].get('uuid'):
|
|
|
notebook = Notebook(document=Document2.objects.get_by_uuid(user=self.user, uuid=action.data['properties']['uuid']))
|
|
|
- statements = notebook.get_str()
|
|
|
- else:
|
|
|
- statements = action.data['properties'].get('statements')
|
|
|
+ #statements = notebook.get_str()
|
|
|
+ statements = '\n\n\n'.join([snippet['statement_raw'] for snippet in notebook.get_data()['snippets']])
|
|
|
+
|
|
|
+ if self.properties.get('send_result_path'):
|
|
|
+ statements = """
|
|
|
+INSERT OVERWRITE DIRECTORY '%s'
|
|
|
+ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
|
|
|
+WITH SERDEPROPERTIES (
|
|
|
+ "separatorChar" = "\t",
|
|
|
+ "quoteChar" = "'",
|
|
|
+ "escapeChar" = "\\"
|
|
|
+)
|
|
|
+STORED AS TEXTFILE %s""" % (self.properties.get('send_result_path'), statements)
|
|
|
|
|
|
if statements is not None:
|
|
|
self._create_file(deployment_dir, action.data['name'] + '.sql', statements)
|