fix: sql查询可指定默认参数

This commit is contained in:
caoqianming 2023-11-16 09:42:08 +08:00
parent 272f2db00a
commit 74ae25faf6
1 changed files with 4 additions and 2 deletions

View File

@ -78,10 +78,12 @@ class DatasetViewSet(CustomModelViewSet):
new_query = dt.default_param
new_query.update(query)
try:
sql_f_ = check_sql_safe(dt.sql_query.format(**query))
sql_f_ = check_sql_safe(
dt.sql_query.format(**new_query))
except KeyError:
raise ParseError('需指定查询参数')
raise ParseError('需指定查询参数')
else:
raise ParseError('需指定查询参数')
sql_f_strip = sql_f_.strip(';')
sql_f_l = sql_f_strip.split(';')
hash_k = hash(sql_f_strip)