Skip to content

Instantly share code, notes, and snippets.

@Stiivi
Created June 12, 2012 22:56
Show Gist options
  • Save Stiivi/2920669 to your computer and use it in GitHub Desktop.
Save Stiivi/2920669 to your computer and use it in GitHub Desktop.
Cubes: Mapping of date parts in date datatype columns
{
"cubes": [
{
"name": "example",
"measures": ["amount"],
"dimensions": ["date"],
"mappings": {
"date.year": {"column":"date", "extract":"year"},
"date.month": {"column":"date", "extract":"month"},
"date.day": {"column":"date", "extract":"day"}
}
}
],
"dimensions": [
{
"name":"date",
"levels": ["year", "month", "day"]
}
]
}
@Stiivi
Copy link
Author

Stiivi commented Jun 12, 2012

According to SQLAlchemy sources, you can extract in most of the databases: 'month', 'day', 'year', 'second', 'hour', 'doy' (day of the year), 'minute', 'quarter', 'dow' (day of the week), 'week', 'epoch', 'milliseconds', 'microseconds', 'timezone_hour', 'timezone_minute'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment