Minor improvements of recorder typing (#80165)

* Minor improvements of recorder typing

* Only allow specifying statistic_ids as lists
This commit is contained in:
Erik Montnemery 2022-10-12 14:59:10 +02:00 committed by GitHub
parent 83557ef762
commit 577f7904b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 30 deletions

View file

@ -1,9 +1,11 @@
"""Schema migration helpers."""
from __future__ import annotations
from collections.abc import Callable, Iterable
import contextlib
from datetime import timedelta
import logging
from typing import Any, cast
from typing import TYPE_CHECKING, cast
import sqlalchemy
from sqlalchemy import ForeignKeyConstraint, MetaData, Table, func, text
@ -40,6 +42,9 @@ from .statistics import (
)
from .util import session_scope
if TYPE_CHECKING:
from . import Recorder
LIVE_MIGRATION_MIN_SCHEMA_VERSION = 0
_LOGGER = logging.getLogger(__name__)
@ -86,7 +91,7 @@ def live_migration(current_version: int) -> bool:
def migrate_schema(
instance: Any,
instance: Recorder,
hass: HomeAssistant,
engine: Engine,
session_maker: Callable[[], Session],