Skip to content

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

@mikenelson-io

Description

@mikenelson-io

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"

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