2025年python cubs 学习(一)

python cubs 学习(一)本系列根据 python cubes 官方文档 rendering Core cube features Workspace Cubes analytical workspace see docs reference Model Description of data metadata cubes dimensions concept

大家好,我是讯享网,很高兴认识大家。

本系列根据python cubes 官方文档rendering

Core cube features:

  • Workspace – Cubes analytical workspace (see docsreference)
  • Model - Description of  data (metadata): cubes, dimensions, concept hierarchies, attributes, labels, localizations. (see docsreference)
  • Browser - Aggregation browsing, slicing-and-dicing, drill-down. (see docsreference)
  • Backend - Actual aggregation implementation and utility functions. (see docsreference)
  • Server - WSGI HTTP server for Cubes (see docsreference)
  • Formatters - Data formatters (see docsreference)
  • slicer - Command Line Tool - command-line tool
  •  
  • 核心多维数据集功能:
  • 工作区–多维数据集分析工作区(请参阅docs参考
  • 模型-数据描述(元数据):多维数据集,维度,概念层次结构,属性,标签,本地化。(请参阅docs参考
  • 浏览器-聚合浏览,切片和切块,下钻。(请参阅docs参考
  • 后端-实际的聚合实施和实用程序功能。(请参阅docs参考
  • 服务器-用于多维数据集的WSGI HTTP服务器(请参阅文档参考
  • 格式化程序-数据格式化程序(请参阅docs参考
  • 切片器-命令行工具-命令行工具

运行第一个helloworld:

pip install cubes[all] pip install SQLAlchemy pip install click pip install flask git clone git://github.com/DataBrewery/cubes.git cd cubes cd examples/hello_world python prepare_data.py slicer serve slicer.ini

讯享网

分析工作区

“多维数据集”中的所有内容都发生在分析工作区中。它包含多维数据集,维护与数据存储的连接(带有多维数据集数据),提供与外部多维数据集的连接等等。

_images / cubes-workspace_simplified.png
讯享网

分析工作空间及其内容

Data Preparation:https://cubes.readthedocs.io/en/latest/tutorial.html  

按官方文档 cubes框架导入slicer.ini文件报错 cubes.errors.ConfigurationError: config should be a ConfigParser instance

老夫试了一下 如下正确:

讯享网from cubes.compat import ConfigParser import ConfigParser configg = ConfigParser() configg.read("slicer.ini") workspace = Workspace(config=configg)

Model:

我理解和mondrian的schemal类似的东西,对cube结构的一个描述(tutorial_model.json)

{ "dimensions": [ { "name":"item", "levels": [ { "name":"category", "label":"Category", "attributes": ["category", "category_label"] }, { "name":"subcategory", "label":"Sub-category", "attributes": ["subcategory", "subcategory_label"] }, { "name":"line_item", "label":"Line Item", "attributes": ["line_item"] } ] }, {"name":"year", "role": "time"} ], "cubes": [ { "name": "ibrd_balance", "dimensions": ["item", "year"], "measures": [{"name":"amount", "label":"Amount"}], "aggregates": [ { "name": "amount_sum", "function": "sum", "measure": "amount" }, { "name": "record_count", "function": "count" } ], "mappings": { "item.line_item": "line_item", "item.subcategory": "subcategory", "item.subcategory_label": "subcategory_label", "item.category": "category", "item.category_label": "category_label" }, "info": { "min_date": "2010-01-01", "max_date": "2010-12-31" } } ] }

Aggregations

Browser is an object that does the actual aggregations and other data queries for a cube. To obtain one:.....

小讯
上一篇 2025-03-30 15:32
下一篇 2025-01-12 14:24

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/61222.html