Home Assistant Unofficial Reference
2024.12.1
postgresql.py
Go to the documentation of this file.
1
"""Provide info to system health for postgresql."""
2
3
from
__future__
import
annotations
4
5
from
sqlalchemy
import
text
6
from
sqlalchemy.orm.session
import
Session
7
8
9
def
db_size_bytes
(session: Session, database_name: str) -> float |
None
:
10
"""Get the mysql database size."""
11
size = session.execute(
12
text(
"select pg_database_size(:database_name);"
),
13
{
"database_name"
: database_name},
14
).scalar()
15
16
if
not
size:
17
return
None
18
19
return
float
(size)
homeassistant.components.airq.const.float
float
Definition:
const.py:11
homeassistant.components.recorder.system_health.postgresql.db_size_bytes
float|None db_size_bytes(Session session, str database_name)
Definition:
postgresql.py:9
core
homeassistant
components
recorder
system_health
postgresql.py
Generated by
1.9.1