Mailing List Archive

cubes library docs are not accurate, first example failing unexpectedly
Hello to All,

I want to create a cube from csv data file and to perform and aggregation
on it, the code is below:

from sqlalchemy import create_enginefrom cubes.tutorial.sql import
create_table_from_csvfrom cubes import Workspace, Cell, browser
import dataif __name__ == '__main__':
engine = create_engine('sqlite:///data.sqlite')
create_table_from_csv(engine,
"../data/data.csv",
table_name="irbd_balance",
fields=[.
("category", "string"),
("category_label", "string"),
("subcategory", "string"),
("subcategory_label", "string"),
("line_item", "string"),
("year", "integer"),
("amount", "integer")],
create_id=True
)
print("done. file data.sqlite created")
workspace = Workspace()
workspace.register_default_store("sql", url="sqlite:///data.sqlite")
workspace.import_model("../model.json")


cube = workspace.cube("irbd_balance")

browser = workspace.browser("irbd_balance")

cell = Cell(cube)
result = browser.aggregate(cell, drilldown=["year"])
for record in result.drilldown:
print(record)





The tutorial and the library are available here:

https://pythonhosted.org/cubes/tutorial.html
The error stack is :


result = browser.aggregate(cell, drilldown=["year"])
File "C:\Users\path\venv\lib\site-packages\cubes\browser.py", line
145, in aggregate
result = self.provide_aggregate(cell,
File "C:\path\venv\lib\site-packages\cubes\sql\browser.py", line
400, in provide_aggregate
(statement, labels) = self.aggregation_statement(cell,
File "C:\path\venv\lib\site-packages\cubes\sql\browser.py", line
532, in aggregation_statement
raise ArgumentError("List of aggregates should not be empty")
cubes.errors.ArgumentError: List of aggregates should not be empty

It seems the tutorial contains some typos.

Any idea how to fix this? Else is there any other better olap cubes
library for Python that has great docs?
--
https://mail.python.org/mailman/listinfo/python-list