superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michel...@apache.org
Subject [incubator-superset] branch master updated: Adding template_params to datasource editor for sqla tables (#6869)
Date Fri, 15 Feb 2019 19:16:20 GMT
This is an automated email from the ASF dual-hosted git repository.

michellet 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 b0f7f51  Adding template_params to datasource editor for sqla tables (#6869)
b0f7f51 is described below

commit b0f7f51ab74a6b33809714cd6e2d02d87ddab445
Author: michellethomas <michelle.q.thomas@gmail.com>
AuthorDate: Fri Feb 15 11:16:04 2019 -0800

    Adding template_params to datasource editor for sqla tables (#6869)
---
 superset/assets/src/datasource/DatasourceEditor.jsx | 8 ++++++++
 superset/connectors/sqla/models.py                  | 1 +
 2 files changed, 9 insertions(+)

diff --git a/superset/assets/src/datasource/DatasourceEditor.jsx b/superset/assets/src/datasource/DatasourceEditor.jsx
index cbc46c8..0d8a1f8 100644
--- a/superset/assets/src/datasource/DatasourceEditor.jsx
+++ b/superset/assets/src/datasource/DatasourceEditor.jsx
@@ -448,6 +448,14 @@ export class DatasourceEditor extends React.PureComponent {
           label={t('Hours offset')}
           control={<TextControl />}
         />
+        { this.state.isSqla &&
+          <Field
+            fieldKey="template_params"
+            label={t('Template parameters')}
+            descr={t('A set of parameters that become available in the query using Jinja
templating syntax')}
+            control={<TextControl />}
+          />
+        }
       </Fieldset>);
   }
 
diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 86d9273..5dd885b 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -431,6 +431,7 @@ class SqlaTable(Model, BaseDatasource):
             d['time_grain_sqla'] = grains
             d['main_dttm_col'] = self.main_dttm_col
             d['fetch_values_predicate'] = self.fetch_values_predicate
+            d['template_params'] = self.template_params
         return d
 
     def values_for_column(self, column_name, limit=10000):


Mime
View raw message