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

Getting Started Notebook fails with Execute error #25

Open
chicagoandy opened this issue Mar 25, 2023 · 1 comment
Open

Getting Started Notebook fails with Execute error #25

chicagoandy opened this issue Mar 25, 2023 · 1 comment

Comments

@chicagoandy
Copy link

After a clean install of the Jupyter plugin I received the following error. The error persisted after updating the getting-started notebook to latest from this repository:

import detective.functions as functions
import pandas as pd

db = detective.db_from_hass_config()
YAML tag !include_dir_merge_named is not supported
Successfully connected to database sqlite:////config/home-assistant_v2.db
Error with query:
SELECT DISTINCT(entity_id) FROM states

'Engine' object has no attribute 'execute'

AttributeError Traceback (most recent call last)
Cell In[10], line 5
2 import detective.functions as functions
3 import pandas as pd
----> 5 db = detective.db_from_hass_config()

File /usr/local/lib/python3.9/dist-packages/detective/core.py:19, in db_from_hass_config(path, **kwargs)
16 path = config.find_hass_config()
18 url = config.db_url_from_hass_config(path)
---> 19 return HassDatabase(url, **kwargs)

File /usr/local/lib/python3.9/dist-packages/detective/core.py:57, in HassDatabase.init(self, url, fetch_entities)
55 print("Successfully connected to database", stripped_db_url(url))
56 if fetch_entities:
---> 57 self.fetch_entities()
58 except Exception as exc:
59 if isinstance(exc, ImportError):

File /usr/local/lib/python3.9/dist-packages/detective/core.py:85, in HassDatabase.fetch_entities(self)
79 """Fetch entities for which we have data."""
80 query = text(
81 """
82 SELECT DISTINCT(entity_id) FROM states
83 """
84 )
---> 85 response = self.perform_query(query)
87 # Parse the domains from the entities.
88 self.entities = [e[0] for e in response]

File /usr/local/lib/python3.9/dist-packages/detective/core.py:73, in HassDatabase.perform_query(self, query, **params)
71 """Perform a query."""
72 try:
---> 73 return self.engine.execute(query, params)
74 except:
75 print(f"Error with query: {query}")

AttributeError: 'Engine' object has no attribute 'execute'

@geiseri
Copy link

geiseri commented May 26, 2023

The notebook needs to be updated to deal with upstream API changes from robmarkcole/HASS-data-detective#154. You can in the meantime use this notebook

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