Schema for validating a normalized MBQL query. This is also the definitive grammar for MBQL, wow!
Schema for validating a *normalized* MBQL query. This is also the definitive grammar for MBQL, wow!
Schema for a valid absolute-datetime clause.
Schema for a valid absolute-datetime clause.
Schema for anything that is a valid :aggregation
clause.
Schema for anything that is a valid `:aggregation` clause.
Schema for a valid aggregation clause.
Schema for a valid aggregation clause.
Schema for any sort of field clause that can be wrapped by a binning-strategy
clause.
Schema for any sort of field clause that can be wrapped by a `binning-strategy` clause.
Schema for a valid binning-strategy clause.
Schema for a valid binning-strategy clause.
Schema for a valid value for the strategy-name
param of a binning-strategy
clause.
Schema for a valid value for the `strategy-name` param of a `binning-strategy` clause.
Schema for a valid contains clause.
Schema for a valid contains clause.
Schema for info.context
; used for informational purposes to record how a query was executed.
Schema for `info.context`; used for informational purposes to record how a query was executed.
Schema for a valid count-where clause.
Schema for a valid count-where clause.
Schema for a valid cum-count clause.
Schema for a valid cum-count clause.
Schema for a valid :database
ID, in the top-level 'outer' query. Either a positive integer (referring to an
actual Database), or the saved questions virtual ID, which is a placeholder used for queries using the
:source-table "card__id"
shorthand for a source query resolved by middleware (since clients might not know the
actual DB for that source query.)
Schema for a valid `:database` ID, in the top-level 'outer' query. Either a positive integer (referring to an actual Database), or the saved questions virtual ID, which is a placeholder used for queries using the `:source-table "card__id"` shorthand for a source query resolved by middleware (since clients might not know the actual DB for that source query.)
Schema for a valid datetime-field clause.
Schema for a valid datetime-field clause.
Schema for all valid datetime bucketing units.
Schema for all valid datetime bucketing units.
Schema for a datetime value drivers will personally have to handle, either an absolute-datetime
form or a
relative-datetime
form.
Schema for a datetime value drivers will personally have to handle, either an `absolute-datetime` form or a `relative-datetime` form.
Schema for a valid distinct clause.
Schema for a valid distinct clause.
Schema for a valid does-not-contain clause.
Schema for a valid does-not-contain clause.
Schema for a valid ends-with clause.
Schema for a valid ends-with clause.
Schema for a valid expression clause.
Schema for a valid expression clause.
Schema for anything that refers to a Field, from the common [:field-id <id>]
to variants like :datetime-field
or
:fk->
or an expression reference [:expression <name>]
.
Schema for anything that refers to a Field, from the common `[:field-id <id>]` to variants like `:datetime-field` or `:fk->` or an expression reference `[:expression <name>]`.
Schema for a valid field-id clause.
Schema for a valid field-id clause.
Schema for a valid field-literal clause.
Schema for a valid field-literal clause.
Schema for any type of valid Field clause, or for an indexed reference to an aggregation clause.
Schema for any type of valid Field clause, or for an indexed reference to an aggregation clause.
Schema for anything that is accepted as a top-level expression definition, either an arithmetic expression such as a
:+
clause or a Field clause such as :field-id
.
Schema for anything that is accepted as a top-level expression definition, either an arithmetic expression such as a `:+` clause or a Field clause such as `:field-id`.
Schema for valid values of the MBQL :fields
clause.
Schema for valid values of the MBQL `:fields` clause.
Schema for a valid MBQL :filter
clause.
Schema for a valid MBQL `:filter` clause.
Schema for query :info
dictionary, which is used for informational purposes to record information about how a query
was executed in QueryExecution and other places. It is considered bad form for middleware to change its behavior
based on this information, don't do it!
Schema for query `:info` dictionary, which is used for informational purposes to record information about how a query was executed in QueryExecution and other places. It is considered bad form for middleware to change its behavior based on this information, don't do it!
Schema for a valid interval clause.
Schema for a valid interval clause.
Perform the equivalent of a SQL JOIN
with another Table or nested :source-query
. JOINs are either explicitly
specified in the incoming query, or implicitly generated when one uses a :fk->
clause.
In the top-level query, you can reference Fields from the joined table or nested query by the :fk->
clause for
implicit joins; for explicit joins, you must specify :alias
yourself; you can then reference Fields by using a
:joined-field
clause, e.g.
[:joined-field "my_join_alias" [:field-id 1]] ; for joins against other Tabless [:joined-field "my_join_alias" [:field-literal "my_field"]] ; for joins against nested queries
Perform the equivalent of a SQL `JOIN` with another Table or nested `:source-query`. JOINs are either explicitly specified in the incoming query, or implicitly generated when one uses a `:fk->` clause. In the top-level query, you can reference Fields from the joined table or nested query by the `:fk->` clause for implicit joins; for explicit joins, you *must* specify `:alias` yourself; you can then reference Fields by using a `:joined-field` clause, e.g. [:joined-field "my_join_alias" [:field-id 1]] ; for joins against other Tabless [:joined-field "my_join_alias" [:field-literal "my_field"]] ; for joins against nested queries
Schema for a valid joined-field clause.
Schema for a valid joined-field clause.
Schema for any valid Field
that is, or wraps, a :joined-field
clause.
Schema for any valid `Field` that is, or wraps, a `:joined-field` clause.
Schema for valid values of a join :fields
clause.
Schema for valid values of a join `:fields` clause.
Schema for a valid sequence of Join
s. Must be a non-empty sequence, and :alias
, if specified, must be unique.
Schema for a valid sequence of `Join`s. Must be a non-empty sequence, and `:alias`, if specified, must be unique.
Strategy that should be used to perform the equivalent of a SQL JOIN
against another table or a nested query.
These correspond 1:1 to features of the same name in driver features lists; e.g. you should check that the current
driver supports :full-join
before generating a Join clause using that strategy.
Strategy that should be used to perform the equivalent of a SQL `JOIN` against another table or a nested query. These correspond 1:1 to features of the same name in driver features lists; e.g. you should check that the current driver supports `:full-join` before generating a Join clause using that strategy.
Schema for an ISO-8601-formatted date string literal.
Schema for an ISO-8601-formatted date string literal.
Schema for an ISO-8601-formattedor datetime string literal.
Schema for an ISO-8601-formattedor datetime string literal.
Schema for an ISO-8601-formatted time string literal.
Schema for an ISO-8601-formatted time string literal.
Schema for a valid, normalized MBQL [inner] query.
Schema for a valid, normalized MBQL [inner] query.
Schema for optional options map for the :named
aggregation clause.
Schema for optional options map for the `:named` aggregation clause.
Schema for a valid, normalized native [inner] query.
Schema for a valid, normalized native [inner] query.
Schema for a valid not-null clause.
Schema for a valid not-null clause.
Schema for an order-by
clause subclause.
Schema for an `order-by` clause subclause.
Schema for an [outer] query, e.g. the sort of thing you'd pass to the query processor or save in
Card.dataset_query
.
Schema for an [outer] query, e.g. the sort of thing you'd pass to the query processor or save in `Card.dataset_query`.
Schema for a valid relative-datetime clause.
Schema for a valid relative-datetime clause.
Schema for map of options tacked on to the end of binning-strategy
clauses by the binning
middleware.
Schema for map of options tacked on to the end of `binning-strategy` clauses by the `binning` middleware.
The ID used to signify that a database is 'virtual' rather than physical.
A fake integer ID is used so as to minimize the number of changes that need to be made on the frontend -- by using something that would otherwise be a legal ID, nothing need change there, and the frontend can query against this 'database' none the wiser. (This integer ID is negative which means it will never conflict with a real database ID.)
This ID acts as a sort of flag. The relevant places in the middleware can check whether the DB we're querying is this 'virtual' database and take the appropriate actions.
The ID used to signify that a database is 'virtual' rather than physical. A fake integer ID is used so as to minimize the number of changes that need to be made on the frontend -- by using something that would otherwise be a legal ID, *nothing* need change there, and the frontend can query against this 'database' none the wiser. (This integer ID is negative which means it will never conflict with a *real* database ID.) This ID acts as a sort of flag. The relevant places in the middleware can check whether the DB we're querying is this 'virtual' database and take the appropriate actions.
Pattern that matches card__id
strings that can be used as the :source-table
of MBQL queries.
Pattern that matches `card__id` strings that can be used as the `:source-table` of MBQL queries.
Schema for a valid value for a :source-query
clause.
Schema for a valid value for a `:source-query` clause.
Schema for the expected keys for a single column in :source-metadata
(:source-metadata
is a sequence of these
entries), if it is passed in to the query.
This metadata automatically gets added for all source queries that are referenced via the card__id
:source-table
form; for explicit :source-query
s you should usually include this information yourself when specifying explicit
:source-query
s.
Schema for the expected keys for a single column in `:source-metadata` (`:source-metadata` is a sequence of these entries), if it is passed in to the query. This metadata automatically gets added for all source queries that are referenced via the `card__id` `:source-table` form; for explicit `:source-query`s you should usually include this information yourself when specifying explicit `:source-query`s.
Schema for a valid value for the :source-table
clause of an MBQL query.
Schema for a valid value for the `:source-table` clause of an MBQL query.
Schema for a valid starts-with clause.
Schema for a valid starts-with clause.
Schema for a valid sum-where clause.
Schema for a valid sum-where clause.
Schema for either a literal datetime string, literal date string, or a literal time string.
Schema for either a literal datetime string, literal date string, or a literal time string.
Schema for a valid time-interval clause.
Schema for a valid time-interval clause.
(validate-query query)
Compiled schema validator for an [outer] Metabase query. (Pre-compling a validator is more efficient; use this
instead of calling (s/validate Query query)
or similar.
Compiled schema validator for an [outer] Metabase query. (Pre-compling a validator is more efficient; use this instead of calling `(s/validate Query query)` or similar.
Type info about a value in a :value
clause. Added automatically by wrap-value-literals
middleware to values in
filter clauses based on the Field in the clause.
Type info about a value in a `:value` clause. Added automatically by `wrap-value-literals` middleware to values in filter clauses based on the Field in the clause.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close