mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Drop sqlachemy_utils workaround (#88393)
This commit is contained in:
parent
1eb20affa1
commit
06213ee595
@ -1075,24 +1075,6 @@ def recorder_db_url(
|
|||||||
assert not hass_fixture_setup
|
assert not hass_fixture_setup
|
||||||
|
|
||||||
db_url = cast(str, pytestconfig.getoption("dburl"))
|
db_url = cast(str, pytestconfig.getoption("dburl"))
|
||||||
if db_url.startswith(("postgresql://", "mysql://")):
|
|
||||||
# pylint: disable-next=import-outside-toplevel
|
|
||||||
import sqlalchemy_utils
|
|
||||||
|
|
||||||
def _ha_orm_quote(mixed, ident):
|
|
||||||
"""Conditionally quote an identifier.
|
|
||||||
|
|
||||||
Modified to include https://github.com/kvesteri/sqlalchemy-utils/pull/677
|
|
||||||
"""
|
|
||||||
if isinstance(mixed, sqlalchemy_utils.functions.orm.Dialect):
|
|
||||||
dialect = mixed
|
|
||||||
elif hasattr(mixed, "dialect"):
|
|
||||||
dialect = mixed.dialect
|
|
||||||
else:
|
|
||||||
dialect = sqlalchemy_utils.functions.orm.get_bind(mixed).dialect
|
|
||||||
return dialect.preparer(dialect).quote(ident)
|
|
||||||
|
|
||||||
sqlalchemy_utils.functions.database.quote = _ha_orm_quote
|
|
||||||
if db_url.startswith("mysql://"):
|
if db_url.startswith("mysql://"):
|
||||||
# pylint: disable-next=import-outside-toplevel
|
# pylint: disable-next=import-outside-toplevel
|
||||||
import sqlalchemy_utils
|
import sqlalchemy_utils
|
||||||
|
Loading…
x
Reference in New Issue
Block a user