使用Cubes库钻取Cube时抛出AttributeError错误求助
Cubes框架使用遇到AttributeError问题求助
我在使用Cubes官方教程代码时遇到问题,具体报错信息:
AttributeError: 'Subquery' object has no attribute 'count'
报错触发代码行:result = browser.aggregate(cell, drilldown={"item":"subcategory", "year":None})
环境配置
- SQLAlchemy版本1.4.4
- Python 3.9
- Cubes v1.1
完整代码
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") full_cube = Cell(cube) result = browser.aggregate(full_cube, drilldown=["item"])#error here throwing: AttributeError: 'Subquery' object has no attribute 'count' for record in result.drilldown: print(record)
完整堆栈跟踪信息
Traceback (most recent call last): File "C:\Users\path\tests\test_cube.py", line 60, in <module> result = browser.aggregate(cell, drilldown=["item"]) File "C:\Users\path\venv\lib\site-packages\cubes\browser.py", line 145, in aggregate result = self.provide_aggregate(cell, File "C:\Users\path\venv\lib\site-packages\cubes\sql\browser.py", line 437, in provide_aggregate count_statement = statement.alias().count() AttributeError: 'Subquery' object has no attribute 'count'
内容的提问来源于stack exchange,提问作者marc nicole
相关产品推荐
相关产品推荐

