mirror of
https://github.com/apache/superset.git
synced 2026-04-24 02:25:13 +00:00
Fix templating in sqla datasource (#4971)
Fix templating in sqla datasource [has migration]
This commit is contained in:
committed by
Maxime Beauchemin
parent
94249ed20c
commit
af4dd59661
@@ -25,6 +25,15 @@ from superset import security_manager
|
||||
from superset.utils import QueryStatus
|
||||
|
||||
|
||||
def json_to_dict(json_str):
|
||||
if json_str:
|
||||
val = re.sub(',[ \t\r\n]+}', '}', json_str)
|
||||
val = re.sub(',[ \t\r\n]+\]', ']', val)
|
||||
return json.loads(val)
|
||||
else:
|
||||
return {}
|
||||
|
||||
|
||||
class ImportMixin(object):
|
||||
export_parent = None
|
||||
# The name of the attribute
|
||||
@@ -216,12 +225,11 @@ class ImportMixin(object):
|
||||
|
||||
@property
|
||||
def params_dict(self):
|
||||
if self.params:
|
||||
params = re.sub(',[ \t\r\n]+}', '}', self.params)
|
||||
params = re.sub(',[ \t\r\n]+\]', ']', params)
|
||||
return json.loads(params)
|
||||
else:
|
||||
return {}
|
||||
return json_to_dict(self.params)
|
||||
|
||||
@property
|
||||
def template_params_dict(self):
|
||||
return json_to_dict(self.template_params)
|
||||
|
||||
|
||||
class AuditMixinNullable(AuditMixin):
|
||||
|
||||
Reference in New Issue
Block a user