"cubes": [
{
"name": "posts_to_social",
"label": "Posts to Social Media",
"dimensions": ["site", "social_provider", "posted_at"],
"aggregates": [
{
"name": "record_count",
"function": "count"
}
],
"mappings": {
"posted_at.year": {"column":"posted_at", "extract":"year"},
"posted_at.quarter": {"column":"posted_at", "extract":"quarter"},
"posted_at.month": {"column":"posted_at", "extract":"month"},
"posted_at.week": {"column":"posted_at", "extract":"week"},
"posted_at.day": {"column":"posted_at", "extract":"day"}
},
"joins": [
{"master":"site_id", "detail":"site.site_id"}
]
}
],
"dimensions": [
{ "name": "site", "attributes": ["site_id", "name"] },
{ "name": "social_provider" },
{ "name": "posted_at",
"label": "Posted",
"template": "date",
"order": "desc"
},
{
"comment": "This is used as a template for other date dimensions.",
"name": "date",
"label": "Date",
"role": "time",
"levels": [
{
"name": "year",
"order": "desc",
"order_attribute": "year",
"label": "Year"
},
{
"name": "quarter",
"label": "Quarter",
"order_attribute": "quarter",
"order": "desc"
},
{
"name": "month",
"label": "Month",
"order_attribute": "month",
"order": "desc"
},
{
"name": "week",
"label": "Week",
"order_attribute": "week",
"order": "desc"
},
{
"name": "day",
"label": "Day",
"order_attribute": "day",
"order": "desc"
}
],
"hierarchies": [
{
"name": "weekly",
"label": "Weekly",
"levels": ["year", "week"]
},
{
"name": "monthly",
"label": "Monthly",
"levels": ["year", "quarter", "month"]
},
{
"name": "daily",
"label": "Daily",
"levels": ["year", "month", "day"]
}
]
}
]
}
DEBUG SQL(aggregation drilldown):
SELECT EXTRACT(year FROM posts_to_social.posted_at) AS "posted_at.year", EXTRACT(quarter FROM posts_to_social.posted_at) AS "posted_at.quarter", EXTRACT(month FROM posts_to_social.posted_at) AS "posted_at.month", count(posts_to_social.id) AS record_count
FROM posts_to_social GROUP BY EXTRACT(year FROM posts_to_social.posted_at), EXTRACT(quarter FROM posts_to_social.posted_at), EXTRACT(month FROM posts_to_social.posted_at)
"GET /cube/posts_to_social/aggregate?drilldown=posted_at%40monthly%3Amonth HTTP/1.1"
slicer sql denormalize --config=slicer.ini
Error: config should be a ConfigParser instance, but is <class 'str'>
slicer sql denormalize slicer.ini
Error: config should be a ConfigParser instance, but is <class 'str'>
slicer serve slicer.ini
2017-07-26 17:59:16,286 DEBUG Models root set to current directory
2017-07-26 17:59:16,286 DEBUG Workspace calendar timezone: None first week day: 0
2017-07-26 17:59:16,417 DEBUG Registered store 'default'
2017-07-26 17:59:16,417 DEBUG Loading model main
2017-07-26 17:59:16,417 DEBUG Importing model from model.json. Provider: None Store: None NS: None
...
We built a django app for product warehousing. Increasingly, the requests are for reporting such as knowing the quantity of the SKU by date etc.
I have looked at cubes. I am not sure if it's overkill to have cubes and Django at the same time. I could add new features to the django app but i was wondering if there's a better way to do this than to sprinkle a bunch of update statements in order to do aggregates that are then stored in another datatable in the postgres database.
Currently, the number of reports we are asked to do is 2. It may grow to 8.
Advice?