From 14a6b3a10e607a733b90d4416cb9d99c1bc7214a Mon Sep 17 00:00:00 2001 From: omegacore Date: Thu, 2 Jan 2020 00:54:01 -0800 Subject: [PATCH] Alert users pymysql is not required for external MariaDB (#11527) * Update recorder.markdown * :pencil2: Tweak Co-authored-by: Franck Nijhof --- source/_integrations/recorder.markdown | 37 +++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/source/_integrations/recorder.markdown b/source/_integrations/recorder.markdown index 875d26c90e0..6fe93a8a3f4 100644 --- a/source/_integrations/recorder.markdown +++ b/source/_integrations/recorder.markdown @@ -121,24 +121,25 @@ If you only want to hide events from your history, take a look at the [`history` Call the service `recorder.purge` to start a purge task which deletes events and states older than x days, according to `keep_days` service data. -| Service data attribute | Optional | Description | -| ---------------------- | -------- | ----------- | -| `keep_days` | yes | The number of history days to keep in recorder database (defaults to the integration `purge_keep_days` configuration) -| `repack` | yes | Rewrite the entire database, possibly saving some disk space. Only supported for SQLite and requires at least as much disk space free as the database currently uses. +| Service data attribute | Optional | Description | +| ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `keep_days` | yes | The number of history days to keep in recorder database (defaults to the integration `purge_keep_days` configuration) | +| `repack` | yes | Rewrite the entire database, possibly saving some disk space. Only supported for SQLite and requires at least as much disk space free as the database currently uses. | ## Custom database engines -| Database engine | `db_url` | -| :---------------|:---------------------------------------------------------| -| SQLite | `sqlite:////PATH/TO/DB_NAME` | -| MariaDB | `mysql+pymysql://SERVER_IP/DB_NAME?charset=utf8` | -| MariaDB         | `mysql+pymysql://user:password@SERVER_IP/DB_NAME?charset=utf8` | -| MySQL | `mysql://SERVER_IP/DB_NAME?charset=utf8` | -| MySQL | `mysql://user:password@SERVER_IP/DB_NAME?charset=utf8` | -| PostgreSQL | `postgresql://SERVER_IP/DB_NAME` | -| PostgreSQL | `postgresql://user:password@SERVER_IP/DB_NAME` | -| PostgreSQL (Socket) | `postgresql://@/DB_NAME` | -| MS SQL Server | `mssql+pyodbc://username:password@SERVER_IP/DB_NAME?charset=utf8;DRIVER={DRIVER};Port=1433;` | +| Database engine | `db_url` | +| :--------------------- | :------------------------------------------------------------------------------------------- | +| SQLite | `sqlite:////PATH/TO/DB_NAME` | +| MariaDB | `mysql+pymysql://SERVER_IP/DB_NAME?charset=utf8` | +| MariaDB | `mysql+pymysql://user:password@SERVER_IP/DB_NAME?charset=utf8` | +| MariaDB (omit pymysql) | `mysql://user:password@SERVER_IP/DB_NAME?charset=utf8` | +| MySQL | `mysql://SERVER_IP/DB_NAME?charset=utf8` | +| MySQL | `mysql://user:password@SERVER_IP/DB_NAME?charset=utf8` | +| PostgreSQL | `postgresql://SERVER_IP/DB_NAME` | +| PostgreSQL | `postgresql://user:password@SERVER_IP/DB_NAME` | +| PostgreSQL (Socket) | `postgresql://@/DB_NAME` | +| MS SQL Server | `mssql+pyodbc://username:password@SERVER_IP/DB_NAME?charset=utf8;DRIVER={DRIVER};Port=1433;` |
@@ -148,6 +149,12 @@ Some installations of MariaDB/MySQL may require an ALTERNATE_PORT (3rd-party hos
+If using an external MariaDB backend (e.g., running on a separate NAS) with Home Assistant, you should omit `pymysql` from the URL. `pymysql` is not included in the base docker image, and is not necessary for this to work. + +
+ +
+ Unix Socket connections always bring performance advantages over TCP, if the database is on the same host as the `recorder` instance (i.e. `localhost`).