The component is using Microsoft ODBC Driver for SQL Server in version 18.0.1.1-1
and supports following versions:
- SQL Server 2012
- SQL Server 2014
- SQL Server 2016
- SQL Server 2017
- SQL Server 2019
- SQL Server 2022
The configuration config.json
contains following properties in parameters
key:
db
host
– stringport
(optional) – int (default1433
)database
– stringuser
– string#password
– stringssh
(optional) – object: Settings for SSH tunnelenabled
– boolsshHost
– string: IP address or hostname of SSH serversshPort
(optional) – int: SSH server port (default22
)localPort
(optional) – int: SSH tunnel local port in Docker container (default33006
)user
(optional) – string: SSH user (default same asdb.user
)compression
(optional) - bool: Enables SSH tunnel compression (defaultfalse
)keys
(optional) – SSH keyspublic
– string: Public SSH key#private
– string: Private SSH key
ssl
(optional) – objectenabled
(optional) – bool (defaultfalse
)ca
– string: Certificate fileverifyServerCert
– boolignoreCertificateCn
(optional) – bool (defaultfalse
)
enabled
(optional) – bool (defaulttrue
)name
(optional) – stringquery
(optional) – string (just one ofquery
ortable
must be set)table
(optional) – object (just one ofquery
ortable
must be set)schema
– stringtableName
– string
columns
(optional) – array of stringsoutputTable
– stringincremental
(optional) – bool (defaultfalse
)incrementalFetchingColumn
(optional) – stringincrementalFetchingLimit
(optional) – intprimaryKey
(optional) – array of stringsretries
(optional) – int: Number of PDO (fallback) retries if an error occurred (default5
)maxTriesBcp
(optional) – int: Number of BCP retries if an error occurred (default1
)nolock
(optional) – bool (defaultfalse
)disableBcp
(optional) – bool: Do not use BCP for export (defaultfalse
)disableFallback
(optional) – bool: Do not use PDO fallback for export (defaultfalse
)nolock
(optional) – bool (defaultfalse
)cdcMode
(optional) – bool (defaultfalse
)cdcModeFullLoadFallback
(optional) – bool (defaultfalse
)queryTimeout
(optional) – int: Number of seconds after which BCP as well as PDO exports will time out (defaultnull
)
Clone this repository and init the workspace with following command:
git clone https://github.com/keboola/db-extractor-mssql
cd db-extractor-mssql
docker compose build
docker compose run --rm dev composer install --no-scripts
Run the test suite using this command:
docker compose run --rm dev composer tests
CREATE LOGIN tests_mssql_extractor WITH PASSWORD = '';
CREATE USER tests_mssql_extractor FOR LOGIN tests_mssql_extractor;
CREATE DATABASE tests_mssql_extractor;
USE tests_mssql_extractor;
CREATE SCHEMA tests;
CREATE TABLE tests.test (id text null, name text null);
INSERT INTO tests.test VALUES ('1', 'martin');
GRANT SELECT ON SCHEMA :: [tests] TO tests_mssql_extractor;