Skip to content

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

Open

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)

Activity

  1. pdsparks commented on Apr 12, 2021

    @pdsparks

    If you hit this problem on a fresh install then I suggest a downgrade of SQLAlchemy to minimum supported version to fix: 0.7.4

    If using pip:

    pip uninstall sqlalchemy
    
    pip install sqlalchemy==0.7.4
    
    

    Other versions may work, but I went straight to the version that I know does work.

  2. rubru2019 commented on Apr 12, 2021

    @rubru2019
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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