Raise an issue for legacy SQL queries that will cause full table scans (#90971)

* 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>
This commit is contained in:
J. Nick Koston
2023-04-08 22:55:45 -04:00
committed by Paulus Schoutsen
co-authored by Paulus Schoutsen
parent 6522a3ad1b
commit dc2f2e8d3f
4 changed files with 116 additions and 5 deletions
+18
View File
@@ -63,6 +63,24 @@ YAML_CONFIG = {
}
}
YAML_CONFIG_FULL_TABLE_SCAN = {
"sql": {
CONF_NAME: "Get entity_id",
CONF_QUERY: "SELECT entity_id from states",
CONF_COLUMN_NAME: "entity_id",
CONF_UNIQUE_ID: "entity_id_12345",
}
}
YAML_CONFIG_FULL_TABLE_SCAN_NO_UNIQUE_ID = {
"sql": {
CONF_NAME: "Get entity_id",
CONF_QUERY: "SELECT entity_id from states",
CONF_COLUMN_NAME: "entity_id",
}
}
YAML_CONFIG_BINARY = {
"sql": {
CONF_DB_URL: "sqlite://",