Utility functions used by the global query processor and middleware functions.
Utility functions used by the global query processor and middleware functions.
(get-in-query m ks)
(get-in-query m ks not-found)
Similar to get-in
but will look in either :query
or recursively in [:query :source-query]
. Using this function
will avoid having to check if there's a nested query vs. top-level query. Results in deeper levels of nesting are
preferred; i.e. if a key is present in both a :source-query
and the top-level query, the value from the source
query will be returned.
Similar to `get-in` but will look in either `:query` or recursively in `[:query :source-query]`. Using this function will avoid having to check if there's a nested query vs. top-level query. Results in deeper levels of nesting are preferred; i.e. if a key is present in both a `:source-query` and the top-level query, the value from the source query will be returned.
(mbql-query? query)
Is the given query an MBQL query?
DEPRECATED: just look at :type
directly since it is guaranteed to be normalized?
Is the given query an MBQL query? DEPRECATED: just look at `:type` directly since it is guaranteed to be normalized?
(normalize-token token)
Inputs: [token :- su/KeywordOrString] Returns: s/Keyword
Convert a string or keyword in various cases (lisp-case
, snake_case
, or SCREAMING_SNAKE_CASE
) to a lisp-cased
keyword.
Inputs: [token :- su/KeywordOrString] Returns: s/Keyword Convert a string or keyword in various cases (`lisp-case`, `snake_case`, or `SCREAMING_SNAKE_CASE`) to a lisp-cased keyword.
(query->remark {{:keys [executed-by query-hash] :as info} :info
query-type :type})
Generate an approparite REMARK to be prepended to a query to give DBAs additional information about the query being
executed. See documentation for mbql->native
and issue #2386
for more information.
Generate an approparite REMARK to be prepended to a query to give DBAs additional information about the query being executed. See documentation for `mbql->native` and [issue #2386](https://github.com/metabase/metabase/issues/2386) for more information.
(query->source-card-id outer-query)
Return the ID of the Card used as the "source" query of this query, if applicable; otherwise return nil
.
Return the ID of the Card used as the "source" query of this query, if applicable; otherwise return `nil`.
(query-hash query)
Inputs: [query] Returns: (Class/forName "[B")
Return a 256-bit SHA3 hash of QUERY as a key for the cache. (This is returned as a byte array.)
Inputs: [query] Returns: (Class/forName "[B") Return a 256-bit SHA3 hash of QUERY as a key for the cache. (This is returned as a byte array.)
(query-without-aggregations-or-limits?
{{aggregations :aggregation :keys [limit page]} :query})
Is the given query an MBQL query without a :limit
, :aggregation
, or :page
clause?
Is the given query an MBQL query without a `:limit`, `:aggregation`, or `:page` clause?
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close