You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/_integrations/recorder.markdown
+14-44Lines changed: 14 additions & 44 deletions
Original file line number
Diff line number
Diff line change
@@ -19,9 +19,17 @@ This integration constantly saves data. If you use the default configuration, th
19
19
20
20
</div>
21
21
22
-
Home Assistant uses [SQLAlchemy](https://www.sqlalchemy.org/), which is an Object Relational Mapper (ORM). This means that you can use **any** SQL backend for the recorder that is supported by SQLAlchemy, like [MySQL](https://www.mysql.com/), [MariaDB](https://mariadb.org/), [PostgreSQL](https://www.postgresql.org/), or [MS SQL Server](https://www.microsoft.com/en-us/sql-server/).
22
+
Home Assistant uses [SQLAlchemy](https://www.sqlalchemy.org/), which is an Object Relational Mapper (ORM). This makes it possible to use a number of database solutions.
23
23
24
-
The default database engine is [SQLite](https://www.sqlite.org/) which does not require any configuration. The database is stored in your Home Assistant configuration directory ('/config/') and is named `home-assistant_v2.db`.
24
+
The supported database solutions are:
25
+
-[MariaDB](https://mariadb.org/) ≥ 10.3
26
+
-[MySQL](https://www.mysql.com/) ≥ 8.0
27
+
-[PostgreSQL](https://www.postgresql.org/) ≥ 12
28
+
-[SQLite](https://www.sqlite.org/) ≥ 3.32.1
29
+
30
+
Although SQLAlchemy supports additional database solutions, it will behave differently on different databases, and features relied on by the recorder may work differently, or not at all, in different databases.
31
+
32
+
The default, and recommended, database engine is [SQLite](https://www.sqlite.org/) which does not require any configuration. The database is stored in your Home Assistant configuration directory ('/config/') and is named `home-assistant_v2.db`.
25
33
26
34
To change the defaults for the `recorder` integration in your installation, add the following to your `configuration.yaml` file:
27
35
@@ -231,10 +239,10 @@ Call the service `recorder.enable` to start again saving events and states to th
231
239
232
240
The following database engines are tested when major changes are made to the recorder. Other database engines do not have an active core maintainer at this time and may require additional work to maintain.
@@ -313,12 +314,6 @@ If you want to use Unix Sockets for PostgreSQL you need to modify the `pg_hba.co
313
314
314
315
</div>
315
316
316
-
<div class='note warning'>
317
-
318
-
If you are using the default `FULL` recovery model for MS SQL Server you will need to manually backup your log file to prevent your transaction log from growing too large. It is recommended you change the recovery model to `SIMPLE` unless you are worried about data loss between backups.
319
-
320
-
</div>
321
-
322
317
### Database startup
323
318
324
319
If you are running a database server instance on the same server as Home Assistant then you must ensure that this service starts before Home Assistant. For a Linux instance running Systemd (Raspberry Pi, Debian, Ubuntu and others) you should edit the service file.
For MS SQL Server you will have to install a few dependencies:
422
-
423
-
```bash
424
-
sudo apt-get install unixodbc-dev
425
-
pip3 install pyodbc
426
-
```
427
-
428
-
If you are in a virtual environment, don't forget to activate it before installing the pyodbc package.
429
-
430
-
```bash
431
-
sudo -u homeassistant -H -s
432
-
source /srv/homeassistant/bin/activate
433
-
pip3 install pyodbc
434
-
```
435
-
436
-
You will also need to install an ODBC Driver. Microsoft ODBC drivers are recommended, however FreeTDS is available for systems that are not supported by Microsoft. Instructions for installing the Microsoft ODBC drivers can be found [here](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server).
437
-
438
-
<div class='note'>
439
-
440
-
If you are using Hass.io, FreeTDS is already installed for you. The db_url you need to use is `mssql+pyodbc://username:password@SERVER_IP:1433/DB_NAME?charset=utf8mb4&driver=FreeTDS`.
0 commit comments