SQL Server
This connector is used to query a Microsoft SQL Server database using SQL.
Requirement: ODBC Driver 18 for SQL Server must be installed on the system.
>
Installation guides: Windows | Linux | macOS
Connection configuration
Two connection modes are available: password and connection_string.
Password mode
| Name | Mandatory | Default | Description |
|---|
| mode | no | password | Connection mode: password or connectionstring |
| hostname | yes | | Server hostname or IP address |
| database | yes | | Database name |
| username | yes | | Username |
| password | yes | | Password |
| port | no | 1433 | Port number |
| encrypt | no | true | Enable connection encryption |
| trustserver_certificate | no | false | Trust the server certificate without validation |
| driver | no | ODBC Driver 18 for SQL Server | ODBC driver name |
Connection string mode
| Name | Mandatory | Default | Description |
|---|
| mode | yes | | Must be connectionstring |
| connectionstring | yes | | SQLAlchemy connection string |
Example (password mode)
connections:
mssql_connection:
type: mssql
hostname: my-server.database.windows.net
database: my_database
username: my_user
password: $var.mssql_password
port: 1433
encrypt: true
trustservercertificate: false
Example (connection string mode)
connections:
mssql_connection:
type: mssql
mode: connection_string
connectionstring: mssql+pyodbc:///?odbcconnect=Driver={ODBC Driver 18 for SQL Server};Server=myserver;Database=mydb;Uid=myuser;Pwd=mypassword;Encrypt=yes;
Test case configuration
| Name | Mandatory | Default | Description |
|---|
| query | yes | | SQL query to execute |
Example
Example SQL Server:
source:
type: mssql
connection: mssql_connection
query: |
SELECT *
FROM employees
WHERE hire_date < '2000-01-01'
expected:
type: csv
path: data/employeesbefore2000.csv
Requirements