【发布时间】:2014-09-26 11:48:15
【问题描述】:
所以我正在尝试使用 Python Cubes Framework 实现一些 BI,但遇到了一些问题。
基本上我正在尝试做一个“简单的”切入点/切片和骰子,但我没有任何运气。我正在使用带有 PostGis 的 PostgreSQL 数据库。
我的model.json 是:
{
"dimensions": [
{"name": "user", "attributes": ["id", "username"]},
{"name": "resources", "attributes": ["id", "resource_simple_name"]},
{"name":"created_on", "role": "time"}
],
"cubes": [
{
"name": "users_resources_likes",
"dimensions": ["user", "resources", "created_on"],
"mappings": {
"user.id": "auth_user.id",
"user.username": "auth_user.username",
"resources.id": "resources.id",
"resources.resource_simple_name": "resources.resource_simple_name",
"created_on": "created_on"
},
"joins": [
{
"master": "user_id",
"detail": "auth_user.id"
},
{
"master": "resource_id",
"detail": "resources.id"
}
]
}
]
}
如果我尝试在切片器上用日期切入
aggregate?drilldown=created_on&cut=created_on:2012
我收到了DataError: (DataError) invalid input syntax for type timestamp with time zone: "2012"
搜索了一段时间后,我读到可能是因为我的 postgresql 数据库有时间戳:
created_on timestamp with time zone NOT NULL DEFAULT '2014-02-10 00:00:00+00'::timestamp with time zone,
所以我尝试这样做:
?drilldown=created_on&cut=created_on:2012-09-15T09:37:59+00:00
我得到一个:
{
error: "unknown_user_error",
message: "Wrong dimension cut string: 'created_on:2012-09-15T09:37:59 00:00'"
}
我做错了什么?是我的model.json 的问题吗?
【问题讨论】:
标签: python postgresql olap olap-cube cubes