You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ti...@apache.org on 2018/06/25 19:04:43 UTC
[incubator-superset] branch master updated: specify hve namespace
for tables (#5268)
This is an automated email from the ASF dual-hosted git repository.
timi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new bd24f85 specify hve namespace for tables (#5268)
bd24f85 is described below
commit bd24f854c96390e53bdfb0a3e5c3122928340acf
Author: timifasubaa <30...@users.noreply.github.com>
AuthorDate: Mon Jun 25 12:04:27 2018 -0700
specify hve namespace for tables (#5268)
---
superset/config.py | 4 ++++
superset/db_engine_specs.py | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/superset/config.py b/superset/config.py
index d03520f..bd02bb4 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -314,6 +314,10 @@ CSV_TO_HIVE_UPLOAD_S3_BUCKET = None
# contain all the external tables
CSV_TO_HIVE_UPLOAD_DIRECTORY = 'EXTERNAL_HIVE_TABLES/'
+# The namespace within hive where the tables created from
+# uploading CSVs will be stored.
+UPLOADED_CSV_HIVE_NAMESPACE = None
+
# A dictionary of items that gets merged into the Jinja context for
# SQL Lab. The existing context gets updated with this dictionary,
# meaning values for existing keys get overwritten by the content of this
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 35b64d6..d6a9144 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -978,6 +978,14 @@ class HiveEngineSpec(PrestoEngineSpec):
return next(unicodecsv.reader(f, encoding='utf-8-sig'))
table_name = form.name.data
+ if config.get('UPLOADED_CSV_HIVE_NAMESPACE'):
+ if '.' in table_name:
+ raise Exception(
+ "You can't specify a namespace. "
+ 'All tables will be uploaded to the `{}` namespace'.format(
+ config.get('HIVE_NAMESPACE')))
+ table_name = '{}.{}'.format(
+ config.get('UPLOADED_CSV_HIVE_NAMESPACE'), table_name)
filename = form.csv_file.data.filename
bucket_path = app.config['CSV_TO_HIVE_UPLOAD_S3_BUCKET']