Convert statistics to use lambda_stmt (#71903)
* Convert stats to use lambda_stmt - Since baked queries are now [deprecated in 1.4](https://docs.sqlalchemy.org/en/14/orm/extensions/baked.html#module-sqlalchemy.ext.baked) the next step is to convert these to `lambda_stmt` https://docs.sqlalchemy.org/en/14/core/connections.html#quick-guidelines-for-lambdas * Update homeassistant/components/recorder/statistics.py Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
@@ -20,7 +20,6 @@ from sqlalchemy import text
|
||||
from sqlalchemy.engine.cursor import CursorFetchStrategy
|
||||
from sqlalchemy.engine.row import Row
|
||||
from sqlalchemy.exc import OperationalError, SQLAlchemyError
|
||||
from sqlalchemy.ext.baked import Result
|
||||
from sqlalchemy.orm.query import Query
|
||||
from sqlalchemy.orm.session import Session
|
||||
from sqlalchemy.sql.lambdas import StatementLambdaElement
|
||||
@@ -123,9 +122,7 @@ def commit(session: Session, work: Any) -> bool:
|
||||
|
||||
|
||||
def execute(
|
||||
qry: Query | Result,
|
||||
to_native: bool = False,
|
||||
validate_entity_ids: bool = True,
|
||||
qry: Query, to_native: bool = False, validate_entity_ids: bool = True
|
||||
) -> list[Row]:
|
||||
"""Query the database and convert the objects to HA native form.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user