Liking cljdoc? Tell your friends :D

metabase.mbql.schema

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!
raw docstring

!=clj

Schema for a valid != clause.

Schema for a valid != clause.
sourceraw docstring

*clj

Schema for a valid * clause.

Schema for a valid * clause.
sourceraw docstring

+clj

Schema for a valid + clause.

Schema for a valid + clause.
sourceraw docstring

-clj

Schema for a valid - clause.

Schema for a valid - clause.
sourceraw docstring

/clj

Schema for a valid / clause.

Schema for a valid / clause.
sourceraw docstring

<clj

Schema for a valid < clause.

Schema for a valid < clause.
sourceraw docstring

<=clj

Schema for a valid <= clause.

Schema for a valid <= clause.
sourceraw docstring

=clj

Schema for a valid = clause.

Schema for a valid = clause.
sourceraw docstring

>clj

Schema for a valid > clause.

Schema for a valid > clause.
sourceraw docstring

>=clj

Schema for a valid >= clause.

Schema for a valid >= clause.
sourceraw docstring

absolute-datetimeclj

Schema for a valid absolute-datetime clause.

Schema for a valid absolute-datetime clause.
sourceraw docstring

ag:*clj

Schema for a valid * clause.

Schema for a valid * clause.
sourceraw docstring

ag:+clj

Schema for a valid + clause.

Schema for a valid + clause.
sourceraw docstring

ag:-clj

Schema for a valid - clause.

Schema for a valid - clause.
sourceraw docstring

ag:divclj

Schema for a valid / clause.

Schema for a valid / clause.
sourceraw docstring

Aggregationclj

Schema for anything that is a valid :aggregation clause.

Schema for anything that is a valid `:aggregation` clause.
sourceraw docstring

aggregationclj

Schema for a valid aggregation clause.

Schema for a valid aggregation clause.
sourceraw docstring

andclj

Schema for a valid and clause.

Schema for a valid and clause.
sourceraw docstring

ascclj

Schema for a valid asc clause.

Schema for a valid asc clause.
sourceraw docstring

avgclj

Schema for a valid avg clause.

Schema for a valid avg clause.
sourceraw docstring

betweenclj

Schema for a valid between clause.

Schema for a valid between clause.
sourceraw docstring

BinnableFieldclj

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.
sourceraw docstring

binning-strategyclj

Schema for a valid binning-strategy clause.

Schema for a valid binning-strategy clause.
sourceraw docstring

BinningStrategyNameclj

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.
sourceraw docstring

containsclj

Schema for a valid contains clause.

Schema for a valid contains clause.
sourceraw docstring

Contextclj

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.
sourceraw docstring

countclj

Schema for a valid count clause.

Schema for a valid count clause.
sourceraw docstring

count-whereclj

Schema for a valid count-where clause.

Schema for a valid count-where clause.
sourceraw docstring

cum-countclj

Schema for a valid cum-count clause.

Schema for a valid cum-count clause.
sourceraw docstring

cum-sumclj

Schema for a valid cum-sum clause.

Schema for a valid cum-sum clause.
sourceraw docstring

DatabaseIDclj

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.)
sourceraw docstring

datetime-fieldclj

Schema for a valid datetime-field clause.

Schema for a valid datetime-field clause.
sourceraw docstring

DatetimeFieldUnitclj

Schema for all valid datetime bucketing units.

Schema for all valid datetime bucketing units.
sourceraw docstring

DateTimeValueclj

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.
sourceraw docstring

descclj

Schema for a valid desc clause.

Schema for a valid desc clause.
sourceraw docstring

distinctclj

Schema for a valid distinct clause.

Schema for a valid distinct clause.
sourceraw docstring

does-not-containclj

Schema for a valid does-not-contain clause.

Schema for a valid does-not-contain clause.
sourceraw docstring

ends-withclj

Schema for a valid ends-with clause.

Schema for a valid ends-with clause.
sourceraw docstring

expressionclj

Schema for a valid expression clause.

Schema for a valid expression clause.
sourceraw docstring

Fieldclj

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>]`.
sourceraw docstring

field-idclj

Schema for a valid field-id clause.

Schema for a valid field-id clause.
sourceraw docstring

field-literalclj

Schema for a valid field-literal clause.

Schema for a valid field-literal clause.
sourceraw docstring

FieldOrExpressionDefclj

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`.
sourceraw docstring

Fieldsclj

Schema for valid values of the MBQL :fields clause.

Schema for valid values of the MBQL `:fields` clause.
sourceraw docstring

Filterclj

Schema for a valid MBQL :filter clause.

Schema for a valid MBQL `:filter` clause.
sourceraw docstring

fk->clj

Schema for a valid fk-> clause.

Schema for a valid fk-> clause.
sourceraw docstring

Infoclj

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!
sourceraw docstring

insideclj

Schema for a valid inside clause.

Schema for a valid inside clause.
sourceraw docstring

is-nullclj

Schema for a valid is-null clause.

Schema for a valid is-null clause.
sourceraw docstring

Joinclj

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
sourceraw docstring

joined-fieldclj

Schema for a valid joined-field clause.

Schema for a valid joined-field clause.
sourceraw docstring

JoinFieldclj

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.
sourceraw docstring

JoinFieldsclj

Schema for valid values of a join :fields clause.

Schema for valid values of a join `:fields` clause.
sourceraw docstring

Joinsclj

Schema for a valid sequence of Joins. 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.
sourceraw docstring

JoinStrategyclj

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.
sourceraw docstring

LiteralDateStringclj

Schema for an ISO-8601-formatted date string literal.

Schema for an ISO-8601-formatted date string literal.
sourceraw docstring

LiteralDatetimeStringclj

Schema for an ISO-8601-formattedor datetime string literal.

Schema for an ISO-8601-formattedor datetime string literal.
sourceraw docstring

LiteralTimeStringclj

Schema for an ISO-8601-formatted time string literal.

Schema for an ISO-8601-formatted time string literal.
sourceraw docstring

maxclj

Schema for a valid max clause.

Schema for a valid max clause.
sourceraw docstring

MBQLQueryclj

Schema for a valid, normalized MBQL [inner] query.

Schema for a valid, normalized MBQL [inner] query.
sourceraw docstring

metricclj

Schema for a valid metric clause.

Schema for a valid metric clause.
sourceraw docstring

minclj

Schema for a valid min clause.

Schema for a valid min clause.
sourceraw docstring

namedclj

Schema for a valid named clause.

Schema for a valid named clause.
sourceraw docstring

NativeQueryclj

Schema for a valid, normalized native [inner] query.

Schema for a valid, normalized native [inner] query.
sourceraw docstring

notclj

Schema for a valid not clause.

Schema for a valid not clause.
sourceraw docstring

not-nullclj

Schema for a valid not-null clause.

Schema for a valid not-null clause.
sourceraw docstring

orclj

Schema for a valid or clause.

Schema for a valid or clause.
sourceraw docstring

OrderByclj

Schema for an order-by clause subclause.

Schema for an `order-by` clause subclause.
sourceraw docstring

Queryclj

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`.
sourceraw docstring

relative-datetimeclj

Schema for a valid relative-datetime clause.

Schema for a valid relative-datetime clause.
sourceraw docstring

ResolvedBinningStrategyOptionsclj

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.
sourceraw docstring

saved-questions-virtual-database-idclj

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.
sourceraw docstring

segmentclj

Schema for a valid segment clause.

Schema for a valid segment clause.
sourceraw docstring

shareclj

Schema for a valid share clause.

Schema for a valid share clause.
sourceraw docstring

source-table-card-id-regexclj

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.
sourceraw docstring

SourceQueryclj

Schema for a valid value for a :source-query clause.

Schema for a valid value for a `:source-query` clause.
sourceraw docstring

SourceQueryMetadataclj

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-querys you should usually include this information yourself when specifying explicit :source-querys.

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.
sourceraw docstring

SourceTableclj

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.
sourceraw docstring

starts-withclj

Schema for a valid starts-with clause.

Schema for a valid starts-with clause.
sourceraw docstring

stddevclj

Schema for a valid stddev clause.

Schema for a valid stddev clause.
sourceraw docstring

sumclj

Schema for a valid sum clause.

Schema for a valid sum clause.
sourceraw docstring

sum-whereclj

Schema for a valid sum-where clause.

Schema for a valid sum-where clause.
sourceraw docstring

TemporalLiteralStringclj

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.
sourceraw docstring

timeclj

Schema for a valid time clause.

Schema for a valid time clause.
sourceraw docstring

time-intervalclj

Schema for a valid time-interval clause.

Schema for a valid time-interval clause.
sourceraw docstring

TimeUnitclj

Valid unit for time bucketing.

Valid unit for time bucketing.
sourceraw docstring

validate-queryclj

(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.
sourceraw docstring

valueclj

Schema for a valid value clause.

Schema for a valid value clause.
sourceraw docstring

ValueTypeInfoclj

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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close