home-assistant / data.home-assistant

Data Science Portal for Home Assistant.
https://data.home-assistant.io
Other
65 stars 53 forks source link

Error on executing Popular Entities code cell in GETTING_STARTED notebook. #292

Open mikenelson-io opened 3 months ago

mikenelson-io commented 3 months ago

Core 2024.8.0 Supervisor 2024.08.0 Operating System 12.4 Validated pip3 installs for all prerequisites

Error on executing Popular Entities code cell in GETTING_STARTED notebook.

Error with query: SELECT * FROM events JOIN event_data ON events.data_id = event_data.data_id WHERE event_type = 'call_service' ORDER BY time_fired
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /usr/local/lib/python3.11/dist-packages/sqlalchemy/engine/base.py:1414, in Connection.execute(self, statement, parameters, execution_options)
   1413 try:
-> 1414     meth = statement._execute_on_connection
   1415 except AttributeError as err:

AttributeError: 'str' object has no attribute '_execute_on_connection'

The above exception was the direct cause of the following exception:

ObjectNotExecutableError                  Traceback (most recent call last)
Cell In[8], line 13
      9 # We keep track of contexts that we processed so that we will only process
     10 # the first service call in a context, and not subsequent calls.
     11 context_processed = set()
---> 13 for event in db.perform_query("SELECT * FROM events JOIN event_data ON events.data_id = event_data.data_id WHERE event_type = 'call_service' ORDER BY time_fired"):
     14     entity_ids = None
     16     # Skip if we have already processed an event that was part of this context

File /usr/local/lib/python3.11/dist-packages/detective/core.py:75, in HassDatabase.perform_query(self, query, **params)
     73 try:
     74     with self.engine.connect() as conn:
---> 75         return conn.execute(query, params)
     76 except:
     77     print(f"Error with query: {query}")

File /usr/local/lib/python3.11/dist-packages/sqlalchemy/engine/base.py:1416, in Connection.execute(self, statement, parameters, execution_options)
   1414     meth = statement._execute_on_connection
   1415 except AttributeError as err:
-> 1416     raise exc.ObjectNotExecutableError(statement) from err
   1417 else:
   1418     return meth(
   1419         self,
   1420         distilled_parameters,
   1421         execution_options or NO_OPTIONS,
   1422     )

ObjectNotExecutableError: Not an executable object: "SELECT * FROM events JOIN event_data ON events.data_id = event_data.data_id WHERE event_type = 'call_service' ORDER BY time_fired"
SnokxStefan commented 2 months ago

DO NOT USE OR INSTALL THIS , DOES NOT WORK AT ALL,, NO DOCUMENTATION, EXAMPLES DO NOT WORK

rct commented 1 month ago

FYI this is related to this issue in the Hass-data-detective module: https://github.com/robmarkcole/HASS-data-detective/issues/157

Since there appears to be some activity in that repo robmarkcole/HASS-data-detective the problem may be that Frenck's add-on https://github.com/hassio-addons/addon-jupyterlab needs updates versions of robmarkcole/HASS-data-detective, sqlalchemy, and perhaps other modules.