Skip to content

AttributeError: 'Subquery' object has no attribute 'count' - Hello world example #495

@rubru2019

Description

@rubru2019

from sqlalchemy import create_engine
from cubes.tutorial.sql import create_table_from_csv

engine = create_engine('sqlite:///data.sqlite')

create_table_from_csv(engine,
"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 )

from cubes import Workspace

workspace = Workspace()
workspace.register_default_store("sql", url="sqlite:///data.sqlite")

workspace.import_model("model.json")
browser = workspace.browser("irbd_balance")

result = browser.aggregate()

result.summary["record_count"]

result.summary["amount_sum"]

cell = result.cell

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions