* Raise an issue for SQL queries that will cause full table scans
* Raise an issue for SQL queries that will cause full table scans
* Raise an issue for SQL queries that will cause full table scans
* Raise an issue for SQL queries that will cause full table scans
* Update homeassistant/components/sql/sensor.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* coverage
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Isolate the sql integration with a seperate query cache
If there were a lot of sql integrations they could affect
the performance of the recorder/logbook/history since they
were sharing the same LRU and since the sql sensor updates
frequently it would evict the recorder queries from the
LRU.
* generate in stmt
* avoid double gen
* Revert "avoid double gen"
This reverts commit 6a5aa65268.
Traceback (most recent call last):
File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
await asyncio.shield(task)
File "/Users/bdraco/home-assistant/homeassistant/components/sql/sensor.py", line 75, in async_setup_platform
await async_setup_sensor(
File "/Users/bdraco/home-assistant/homeassistant/components/sql/sensor.py", line 150, in async_setup_sensor
sessmaker := await hass.async_add_executor_job(
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/bdraco/home-assistant/homeassistant/components/sql/sensor.py", line 205, in _validate_and_get_session_maker_for_db_url
if sess:
UnboundLocalError: local variable 'sess' referenced before assignment
* Fix sql doing I/O in the event loop
* Fix sql doing I/O in the event loop
* no test query on main db
* fix mocking because it was targeting the recorder