Comments (3)
According to #150 , I modified the code given by:
https://stackoverflow.com/questions/75316741/attributeerror-engine-object-has-no-attribute-execute-when-trying-to-run-sq/75316945#75316945
in the core.py
file, line 74 to:
with self.engine.connect() as conn:
return conn.execute(query, params)
However, this didn't work when running the notebook section:
db = detective.HassDatabase(db_url) # To init without fetching entities fetch_entities=False
and threw the following error:
Successfully connected to database sqlite:////home/config/.homeassistant/home-assistant_v2.db
Error with query:
SELECT DISTINCT(entity_id) FROM states(sqlite3.OperationalError) unable to open database file
(Background on this error at: https://sqlalche.me/e/14/e3q8)
OperationalError: (sqlite3.OperationalError) unable to open database file
(Background on this error at: https://sqlalche.me/e/14/e3q8)
After this, I tried to change the sqlalchemy
version to 1.4.x by:
pip install sqlalchemy==1.4.1
and run the same section:
db = detective.HassDatabase(db_url) # To init without fetching entities fetch_entities=False
This still got the same error.
But interestingly, the section:
db = detective.db_from_hass_config()
worked! The output is:
Successfully connected to database sqlite:////config/home-assistant_v2.db
There are 89 entities with data
Entities are listed on an attribute
So, what could be done to solve this problem? Is there any better ways to modified the code so that it could adapt the 2.0.x version of sqlalchemy?
from hass-data-detective.
resolved with
def perform_query(self, query, **params):
"""Perform a query."""
try:
with self.engine.connect() as conn:
return conn.execute(query, params)
except:
print(f"Error with query: {query}")
raise
from hass-data-detective.
This means that HASS-data-detective only runs with HA 2023.4 and newer. In older versions, there is no state_meta and HASS-data-detective 2.6 does not work because it uses engine.execute()
from hass-data-detective.
Related Issues (20)
- Query event table
- checkout traces
- Problem with View States section in Getting Started : 'HassDatabase' object has no attribute 'fetch_all_data' HOT 6
- Add streamlit UI to allow viewing historical data and make predictions HOT 3
- Add support for !include_dir_* HOT 10
- Tryout plotly time series
- Checkout jupyterlite HOT 3
- Column "domain" does not exist HOT 12
- OperationalError: no such column: domain HOT 1
- Add query on statistics tables
- CI action failing to to flake8
- TypeError: the JSON object must be str, bytes or bytearray, not NoneType HOT 5
- Raspbian failed HOT 1
- Fix sql api HOT 3
- Add test.db for functional tests
- Updates to schema
- Wrong time format in functions.format_dataframe() output? HOT 2
- Error using Windows: expected str, bytes or os.PathLike object, not HassDatabase HOT 1
- AttributeError: 'str' object has no attribute '_execute_on_connection' HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hass-data-detective.