DataBrewery / cubes

[NOT MAINTAINED] Light-weight Python OLAP framework for multi-dimensional data analysis
http://cubes.databrewery.org
Other
1.49k stars 313 forks source link

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

Open rubru2019 opened 3 years ago

rubru2019 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Thank you!

best regards Rudolf


From: Philip Sparks @.> Sent: Monday, April 12, 2021 11:45 To: DataBrewery/cubes @.> Cc: Brugman, Rudolf @.>; Author @.> Subject: Re: [DataBrewery/cubes] AttributeError: 'Subquery' object has no attribute 'count' - Hello world example (#495)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FDataBrewery%2Fcubes%2Fissues%2F495%23issuecomment-817661182&data=04%7C01%7Cbrugman.r%40hsleiden.nl%7C5cd933f839f34a6e8f8708d8fd97b749%7C850f9344e078467e9c5e84d82f208ac7%7C1%7C0%7C637538175344137984%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=R8L%2BsChqz2Pmg5WGEdYbfRFHaiNuEH6tY3707hRS6xg%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMDYNNPE22DOTEBCVJ2ULXLTIK6LXANCNFSM42OUNEYQ&data=04%7C01%7Cbrugman.r%40hsleiden.nl%7C5cd933f839f34a6e8f8708d8fd97b749%7C850f9344e078467e9c5e84d82f208ac7%7C1%7C0%7C637538175344137984%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wMZJ1yL715DBRvHM2mhX4r0DcDyGdG2Rn3SjyOaaIWU%3D&reserved=0.

Op deze e-mail zijn de voorwaarden van toepassing als vermeld op: The following conditions apply to this e-mail: http://www.hsleiden.nl/disclaimer-email