diff --git a/src/metabase/api/dataset.clj b/src/metabase/api/dataset.clj index 189f90a5bc5d01dc916a84915b5e2d96984f2948..b9566fc7863d78fe1766f99e3a2c2a43f372b8ca 100644 --- a/src/metabase/api/dataset.clj +++ b/src/metabase/api/dataset.clj @@ -69,8 +69,9 @@ "Execute a query and download the result data as a CSV file." [query] {query su/JSONString} - (read-check Database (:database query)) - (as-csv (qp/dataset-query (json/parse-string query keyword) {:executed-by *current-user-id*}))) + (let [query (json/parse-string query keyword)] + (read-check Database (:database query)) + (as-csv (qp/dataset-query query {:executed-by *current-user-id*})))) (define-routes)