feat: bi exec查询参数校验

This commit is contained in:
caoqianming 2023-07-07 15:36:06 +08:00
parent 31ec00ba55
commit 9d26946195
1 changed files with 4 additions and 3 deletions

View File

@ -69,9 +69,10 @@ class DatasetViewSet(CustomModelViewSet):
can_cache = True
if dt.sql_query:
sql_f_ = check_sql_safe(dt.sql_query.format(**query))
if '{' in sql_f_:
raise ParseError('未指定查询参数')
try:
sql_f_ = check_sql_safe(dt.sql_query.format(**query))
except KeyError:
raise ParseError('需指定查询参数')
sql_f_l = sql_f_.strip(';').split(';')
hash_k = hash(sql_f_.strip(';'))
hash_v = cache.get(hash_k, None)