Code Monkey home page Code Monkey logo

Comments (9)

martin18d avatar martin18d commented on June 21, 2024 2

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.

geiseri avatar geiseri commented on June 21, 2024 1

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.

robmarkcole avatar robmarkcole commented on June 21, 2024

Make sure you are using a virtual env - there were changes in sqlalchemy==2.0.7

from hass-data-detective.

k-w-1 avatar k-w-1 commented on June 21, 2024

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.

rorso avatar rorso commented on June 21, 2024

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.

k-w-1 avatar k-w-1 commented on June 21, 2024

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.

robmarkcole avatar robmarkcole commented on June 21, 2024

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.

rorso avatar rorso commented on June 21, 2024

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.

ahoy avatar ahoy commented on June 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.