Comments (9)
I think the issue here is with how the "perform_query" function is being called. It's setup to accept queries in the form of sqlalchemy text clauses, but the notebook has the function accepting a raw string.
To use the perform_query function, you need:
from sqlalchemy import text
db.perform_query(text('SELECT * FROM events'))
Right?
from hass-data-detective.
Actually, this is an issue unique to home assistant's addon. It is out of date. For a better experience in jupyter "File" -> "Open From URL" and use the link here. Then all is right with the world!
Since you are in home-assistant you can use the db = detective.db_from_hass_config()
to get the db connection.
from hass-data-detective.
Make sure you are using a virtual env - there were changes in sqlalchemy==2.0.7
from hass-data-detective.
Make sure you are using a virtual env - there were changes in sqlalchemy==2.0.7
Could you expand? I'm not sure if this is what @rorso meant, but I'm also running HAOS in an x86 VM (e.g. with supervisor & the HACA JupyterLab add-on), and getting the same error. Although I'm guessing it is inconsequential per the DB connect success that I'm seeing, I'm also running the official MariaDB add-on.
I can't see any (er, obvious to me) way to run/change a venv in this setup, although I did try adding a cell immediately following !pip show HASS-data-detective
with !pip install --force-reinstall -v "SQLAlchemy==2.0.6"
which notably complains that hass-data-detective 3.0 requires SQLAlchemy>=2.0.7; and !pip install --force-reinstall -v "SQLAlchemy==2.0.7"
still presents the same error.
TIA!
from hass-data-detective.
I'm really sorry. It may be obvious to you, but not to me. "Just do lfakjsasjfladjfhal" sounds like a magic spell to me. There are people outside that are not digital natives, although I follow the technology a couple of decades now.
But I did try to get enlightened about "virtual env". It seems that I have to mess around heavily with the way my HA installation is running - which will not happen. I'm glad that it works great as is and I see no point in a total rework of my installation just to get this python script running, no matter how useful it might be.
from hass-data-detective.
I'm really sorry. It may be obvious to you, but not to me. "Just do lfakjsasjfladjfhal" sounds like a magic spell to me. There are people outside that are not digital natives, although I follow the technology a couple of decades now.
But I did try to get enlightened about "virtual env". It seems that I have to mess around heavily with the way my HA installation is running - which will not happen. I'm glad that it works great as is and I see no point in a total rework of my installation just to get this python script running, no matter how useful it might be.
Sorry, I think I was misunderstood 🙂.
I was asking robmarkcole for more information about what he meant by using a virtual env (for what it's worth, I'm glad you didn't mess with your HA -- this add-on is a docker container, so AFAIK, any changes to the virtual env (aka venv) would need to be inside the docker container (each HA Add-on being in essence, a lightweight VM running inside our HA VMs)).
Anyway, I only happened to mention your username as, like you, I also happen to be running HA as a virtual machine -- in case this is relevant to the issue at hand.
Cheers;
K
from hass-data-detective.
Some info on virtual environments:
https://docs.python.org/3/tutorial/venv.html
This repository readme also include instructions for how to run detective in Docker
The issue here is I suspect the python environment people are installing this package into has some conflicting requirements, so the way to rule this out is by using a virtual or isolated environment
from hass-data-detective.
Actually, this is an issue unique to home assistant's addon. It is out of date.
Thank you! This gets me almost running.
Hopefully the addon will be updated soon.
from hass-data-detective.
I think the issue here is with how the "perform_query" function is being called. It's setup to accept queries in the form of sqlalchemy text clauses, but the notebook has the function accepting a raw string.
To use the perform_query function, you need:
from sqlalchemy import text
db.perform_query(text('SELECT * FROM events'))
Right?
This is what worked for me. I am using a Postgres database as the back-end, so not sure if that affects how these functions work.
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
- AttributeError: 'Engine' object has no attribute 'execute' when excuting detective.HassDatabase(db_url) HOT 3
- 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
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.