Skippr is now Manifold.

Skip to content

SQL Server ​

The SQL Server source reads tables from one Microsoft SQL Server database and loads each table in full, once. Later sync runs skip tables that are already loaded, so new and changed rows are not picked up and deletes are not captured. Use it for migrations and one-off copies of a database into a warehouse.

Before you begin ​

  • Network access. The machine running Mfd must reach the server on its port (default 1433).
  • No TLS. Mfd connects to SQL Server without encryption, including the login. The server must not force encryption (Force Encryption off in SQL Server Configuration Manager), and you should run Mfd on a private network or through a tunnel. Azure SQL Database always requires encryption, so this source cannot connect to it.
  • A SQL login with read access. Mfd lists tables from INFORMATION_SCHEMA and runs SELECT * on each one. db_datareader covers both:
sql
CREATE LOGIN mfd WITH PASSWORD = 'Change-me-123!';
USE MyDB;
CREATE USER mfd FOR LOGIN mfd;
ALTER ROLE db_datareader ADD MEMBER mfd;

Configure ​

The connection string holds the password, so keep the whole string in an environment variable. Mfd also reads .env and .env.local next to mfd.yml.

bash
export MSSQL_CONNECTION_STRING="server=tcp:sql.internal,1433;database=MyDB;user id=mfd;password=Change-me-123!"
python
from mfd import Config, DataSourceMssql, EnvRef, Pipeline

cfg = Config.discover()
src = cfg.data_source(
    "sqlserver",
    DataSourceMssql(
        connection_string=EnvRef("MSSQL_CONNECTION_STRING"),
        tables=["dbo.customers", "dbo.orders"],
    ),
)
pipe = cfg.pipeline("sqlserver", Pipeline(data_source=src))
cfg.save()
bash
mfd connect data-source mssql \
  --pipeline sqlserver \
  --name sqlserver \
  --connection-string '${MSSQL_CONNECTION_STRING}' \
  --tables dbo.customers \
  --tables dbo.orders
yaml
pipelines:
  sqlserver:
    data_source: data_sources.sqlserver

data_sources:
  sqlserver:
    Mssql:
      connection_string: ${MSSQL_CONNECTION_STRING}
      tables: ["dbo.customers", "dbo.orders"]

Omit tables to load every base table in the database.

Add a destination to the pipeline (see the connector catalog), then discover the schema and run one sync pass:

python
from mfd import Session

session = Session(pipe)
session.discover()
session.sync(once=True)
bash
mfd discover --pipeline sqlserver --log
mfd sync --pipeline sqlserver --once --log

To try the source locally, start SQL Server in Docker and point the connection string at it:

bash
docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=YourStrong!Passw0rd' \
  -p 1433:1433 --name mssql-dev \
  -d mcr.microsoft.com/mssql/server:2022-latest

export MSSQL_CONNECTION_STRING="server=tcp:127.0.0.1,1433;database=master;user id=sa;password=YourStrong!Passw0rd"

Options ​

KeyTypeDefaultDescription
connection_string${ENV} referenceRequiredADO.NET-style connection string: server=tcp:<host>,<port>;database=<db>;user id=<login>;password=<password>.
tableslist of stringsevery base table in the databaseTables to read, as schema.table, or table for the dbo schema.
batch_size_rowsinteger10000Rows per snapshot chunk. YAML may lower this; it cannot raise the ceiling.
query_timeout_secondsintegernoneNot used by this source.
formatstringarrow_ipcLeave unset, or set arrow_ipc. Any other value is rejected. Rows are sent as Arrow IPC.
batch_size_bytesintegernoneNot used by this source.
batch_size_secondsintegernoneNot used by this source.

What gets synced ​

Tables. The tables in tables, or every base table in INFORMATION_SCHEMA.TABLES when you omit it. Views are not included in discovery. Mfd streams each table in batches of 10,000 rows and, when the table has a single integer primary key, splits that key into ranges scanned on one connection inside SET TRANSACTION ISOLATION LEVEL SNAPSHOT. A large table does not sit in memory as one SELECT *.

Table names. Each source table lands in a destination table named after the table alone, without the schema: dbo.customers becomes customers. Mfd lowercases names and replaces characters other than letters, digits, and _ with _. Tables with the same name in different schemas land in the same destination table, so split them across pipelines if you need them apart.

Types.

SQL Server typeArrives as
tinyint, smallint, int, bigintinteger
real, floatnumber
decimal, numeric, money, smallmoneydecimal
bitboolean
char, varchar, nchar, nvarchar, text, ntext, xmlstring
uniqueidentifierstring
datedate
timestring
datetime, datetime2, smalldatetime, datetimeoffsettimestamp
binary, varbinary, imagebinary

Run mfd discover to infer column types; see Schema discovery and evolution.

Incremental behaviour. Mfd records each snapshot chunk as loaded once its rows are durably written. Later runs skip those chunks, even if rows changed. To reload the database, run the source under a new pipeline name, which starts with fresh progress.

Deletes. Not captured.

Troubleshooting ​

Run sync with --log to see these messages. A connection failure is logged, and the run ends without loading anything.

SymptomCauseFix
Failed to connect to MSSQL in the logWrong server, port, or credentials, or no network path.Check the connection string and that port 1433 (or yours) is reachable from the machine running Mfd.
Login failed for userWrong login or password, or SQL authentication is disabled.Check the login, and enable SQL Server and Windows Authentication mode on the server.
The connection is refused during login with an encryption errorThe server forces encryption, or it is Azure SQL Database.Turn off Force Encryption for this server on a private network. Encrypted connections are not supported by this source.
Failed to query table ... in the log, and that table is missingThe name is wrong or the login lacks SELECT.Fix the entry in tables, or add the login to db_datareader. Other tables still load.
Two source tables end up in one destination tableThey share a name in different schemas.Put each schema in its own pipeline.
Changed rows never arriveEach table loads once.Run the source under a new pipeline name to take a fresh copy.

Next steps ​