mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
Fix MS SQL connection string examples (#17801)
pyodbc parameters passed via a connection string to sqlalchemy should be
passed as query string parameters and must be lower case.
sqlalchemy includes the following note in their source code:
Note that in order for the dialect to recognize these keywords
(including the ``driver`` keyword above) they must be all lowercase.
Multiple additional keyword arguments must be separated by an
ampersand (``&``), not a semicolon::
13d01a03c5/lib/sqlalchemy/dialects/mssql/pyodbc.py (L56-L59)
This commit is contained in:
parent
8b23a1863d
commit
b74d8f28ef
@ -241,7 +241,7 @@ The following database engines are tested when major changes are made to the rec
|
||||
| PostgreSQL | `postgresql://user:password@SERVER_IP/DB_NAME` |
|
||||
| PostgreSQL (Socket) | `postgresql://@/DB_NAME` |
|
||||
| PostgreSQL (Custom socket dir) | `postgresql://@/DB_NAME?host=/path/to/dir` |
|
||||
| MS SQL Server | `mssql+pyodbc://username:password@SERVER_IP/DB_NAME?charset=utf8;DRIVER={DRIVER};Port=1433;` |
|
||||
| MS SQL Server | `mssql+pyodbc://username:password@SERVER_IP:1433/DB_NAME?charset=utf8&driver=DRIVER` |
|
||||
|
||||
<div class='note'>
|
||||
|
||||
@ -392,6 +392,6 @@ You will also need to install an ODBC Driver. Microsoft ODBC drivers are recomme
|
||||
|
||||
<div class='note'>
|
||||
|
||||
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/DB_NAME?charset=utf8mb4;DRIVER={FreeTDS};Port=1433;`.
|
||||
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`.
|
||||
|
||||
</div>
|
||||
|
@ -176,7 +176,7 @@ Use the same `db_url` as for the `recorder` integration. Change `DB_NAME` to the
|
||||
```yaml
|
||||
sensor:
|
||||
- platform: sql
|
||||
db_url: "mssql+pyodbc://username:password@SERVER_IP/DB_NAME?charset=utf8;DRIVER={FreeTDS};Port=1433;"
|
||||
db_url: "mssql+pyodbc://username:password@SERVER_IP:1433/DB_NAME?charset=utf8&driver=FreeTDS"
|
||||
queries:
|
||||
- name: DB size
|
||||
query: "SELECT TOP 1 SUM(m.size) * 8 / 1024 as size FROM sys.master_files m INNER JOIN sys.databases d ON d.database_id=m.database_id WHERE d.name='DB_NAME';"
|
||||
|
Loading…
x
Reference in New Issue
Block a user