Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rubru2019 opened this issue Apr 6, 2021 · 2 comments

Comments

@rubru2019
Copy link

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)

@pdsparks
Copy link

pdsparks commented Apr 12, 2021

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.

@rubru2019
Copy link
Author

rubru2019 commented Apr 12, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants