Usage
dimension: order_date {
datatype: date
}
}
Hierarchydatatype |
Possible Field TypesDimension, Dimension Group, Filter, MeasureDefault Valuetimestamp
AcceptsOne of several possible values |
Definition
The datatype
parameter lets you specify the type of time or date data in your database table that you are supplying to your dimension, dimension_group, filter, or measure field. Matching the data type to your field can increase query performance.
For dimensions, filters, and measures the contain date or time data, and for dimension groups with type: time
, the datatype
parameter applies to the sql
parameter of the dimension group.
For dimension groups with type: duration
, the datatype
parameter applies to both the sql_start
and sql_end
parameters, so be sure the sql_start
and sql_end
are both of the specified data type.
The datatype
parameter accepts the following values:
epoch
- a SQL epoch field (i.e., an integer representing the number of seconds from the Unix epoch)date
- a SQL date field (i.e., one that does not contain time of day information)datetime
- a SQL datetime fieldtimestamp
- a SQL timestamp fieldyyyymmdd
- a SQL field that contains an integer that represents a date of the form YYYYMMDD
The default value for datatype
is timestamp
.
Example
Create a dimension_group
for a date field. Set the datatype:
to date
to increase query performance.