MS SQL Server
Minimum SQL Server grants for each Nilus pipeline mode: batch read and write, native CDC, and metadata ingestion.
This page defines the minimum Microsoft SQL Server (MSSQL) grants a platform or database administrator must provision for a Nilus pipeline user. It covers every pipeline type Nilus supports against an MSSQL depot: batch reads and writes, change data capture (CDC) through SQL Server native CDC and the Debezium SQL Server connector, and metadata ingestion. Grant only the privileges that match the pipeline types a given user actually runs.
Read data: MSSQL as source (type: batch)
Used when the depot is referenced in source.address of a Nilus pipeline config. Nilus issues SELECT queries (full scan or incremental via a cursor column) against the target table.
Minimum grants
-- Database access
GRANT CONNECT ON DATABASE::<database_name> TO <user>;
-- Schema-level read
GRANT SELECT ON SCHEMA::<schema_name> TO <user>;To restrict access to a specific table only, grant SELECT on the table instead of the schema:
GRANT SELECT ON <schema_name>.<table_name> TO <user>;CDC source: MSSQL (type: cdc)
Nilus captures row-level changes via SQL Server's native CDC mechanism using the Debezium SQL Server connector. The connector reads from SQL Server change tables, which are populated by SQL Server Agent jobs.
Server-side prerequisites (one-time, requires sysadmin or db_owner)
Step 1: Enable CDC on the database.
Step 2: Enable CDC on each table to be captured.
By default, @role_name is NULL and any user with db_datareader can read the change tables. Setting @role_name to a role name restricts read access to members of that role, so the CDC user must be added to it.
Step 3: Confirm SQL Server Agent is running.
Two SQL Agent jobs are auto-created per database: cdc.<db>_capture (reads the transaction log) and cdc.<db>_cleanup (removes expired change data). CDC does not function while the Agent is stopped.
Runtime user grants
db_datareader grants read access to user tables, but it does not extend to the cdc schema where change tables are stored. Grant SELECT on the cdc schema separately so the connector can read captured rows. As an alternative to db_datareader, grant column-scoped SELECT on each captured table and add the user to the CDC gating role if @role_name was configured.
Write data: MSSQL as destination (type: batch, type: cdc)
Used when the depot is referenced in sink.address of a Nilus pipeline config. Nilus manages table creation and data loading.
Minimum grants (covers all strategies)
Grants by incremental strategy
append
CONNECT, INSERT, CREATE TABLE (if new table)
merge
CONNECT, INSERT, UPDATE, DELETE, SELECT, CREATE TABLE (if new table)
replace
CONNECT, INSERT, DELETE / TRUNCATE TABLE, CREATE TABLE (if new table)
Metadata ingestion: MSSQL source connector (type: metadata)
Used when the depot is referenced in source.address of a type: metadata Nilus pipeline. All metadata workflow steps run for MSSQL: the Nilus orchestration layer excludes none of them for this source type.
Workflow steps that run for MSSQL
Metadata (tables, views, columns, stored procedures)
Yes
Always
Lineage
Yes
Always
Usage
Yes
Always
Profiler
Yes
deep mode only
Classification
Yes
deep mode only
Grants by workflow type
Basic metadata (tables, views, columns, stored procedures, profiler):
View definitions and view lineage:
Without VIEW DEFINITION, SQL Server returns NULL for the view body. Views are ingested without their SQL definition, and no view lineage is created. SQL Server does not raise an error, which makes this a hard-to-diagnose gap.
Usage and lineage (reads from SQL Server plan cache):
Additional grants summary
Basic metadata
GRANT SELECT TO <user>
Database
View definitions / view lineage
GRANT VIEW DEFINITION TO <user>
Database
View definitions / view lineage
GRANT VIEW ANY DEFINITION TO [<login>]
Server (alternative)
Usage & lineage (query plan cache)
GRANT VIEW SERVER STATE TO <user>
Server
Permission matrix
Use case
CONNECT
SELECT
INSERT/UPDATE/DELETE
CREATE TABLE
db_datareader
VIEW DEFINITION
VIEW SERVER STATE
Read (source, batch)
Yes
Yes
No
No
No
No
No
CDC source
Yes
Yes (snapshot)
No
No
Yes
No
Yes
Write: append
Yes
No
INSERT
Yes (if new)
No
No
No
Write: merge
Yes
Yes
Yes
Yes (if new)
No
No
No
Write: replace
Yes
No
INSERT + DELETE
Yes (if new)
No
No
No
metadata (basic)
Yes
Yes
No
No
No
No
No
view lineage
Yes
Yes
No
No
No
Yes
No
usage / lineage
Yes
Yes
No
No
No
No
Yes
Notes
sp_cdc_enable_dbrequiressysadminordb_ownerprivileges. This is a one-time admin action per database: once enabled, it cannot be disabled without dropping all CDC configuration for that database.GRANT SELECT ON SCHEMA::cdcis required separately.db_datareaderdoes not include thecdcschema, and the CDC change tables live there, so grant it explicitly.Schema evolution requires a new capture instance. SQL Server CDC does not update the change table automatically when a column is added or removed. Run
sp_cdc_enable_tableagain with a new@capture_instancename; the connector detects and migrates to the new instance automatically. Drop the old capture instance only after the migration is confirmed.
Last updated
Was this helpful?