Synapse
Access configuration details to connect Soda to an Azure Synapse Analytics data source.
Requirements
Install the Microsoft ODBC driver for SQL Server before you configure the connection. Soda uses ODBC Driver 18 for SQL Server unless you set a different driver.
Connection configuration reference
Install the following package:
pip install soda-synapseData source YAML
Create a file named ds_config.yml. The following example uses SQL authentication:
type: synapse
name: my_synapse
connection:
host: <workspace-name>.sql.azuresynapse.net
port: 1433
database: ${env.SYNAPSE_DB}
authentication: sql
user: ${env.SYNAPSE_USER}
password: ${env.SYNAPSE_PW}Set host to the endpoint of the pool you want to scan. For a dedicated SQL pool in a Synapse workspace, use <workspace-name>.sql.azuresynapse.net. For a serverless SQL pool, use <workspace-name>-ondemand.sql.azuresynapse.net. For a standalone dedicated SQL pool (formerly SQL DW), use <server-name>.database.windows.net. Set database to the dedicated pool name or to the serverless database name.
Authentication
The authentication value determines which credential fields are required.
authentication
Required fields
Notes
sql
user, password
SQL login.
activedirectoryserviceprincipal
client_id, client_secret
Microsoft Entra service principal. Use this for scheduled scans.
activedirectorypassword
user, password
Microsoft Entra user. Microsoft has deprecated this method in its SQL drivers.
activedirectoryinteractive
user
Opens a sign-in prompt. Works with the Windows ODBC driver only.
workloadidentity
none (client_id optional)
User-assigned managed identity through Microsoft Entra Workload ID. See Workload identity.
Always set authentication. If you leave it out, Soda infers the method from the fields you provide: user with password resolves to sql, and user alone resolves to activedirectoryinteractive. Other Entra methods, such as system-assigned managed identity, aren't supported.
The following example uses a service principal:
Workload identity
Set authentication: workloadidentity to connect as a user-assigned managed identity through Microsoft Entra Workload ID. Soda exchanges the Kubernetes service account token of its pod for a Microsoft Entra access token, so no password or client secret is stored.
Requires Soda Core
4.30.0or later. On a Soda Runner, it requires version2.0.21or later of the Soda Runner Helm chart.Soda reads
AZURE_TENANT_ID,AZURE_CLIENT_ID, andAZURE_FEDERATED_TOKEN_FILEfrom the environment. On AKS, the Azure workload identity webhook sets them. To set this up for a Soda Runner, see Using workload identities.Do not set
user,password, orclient_secret. Soda rejects a configuration that contains them with this method.Leave out
scopefor the Azure public cloud. For Azure Government, set it tohttps://database.usgovcloudapi.net/.default; for Azure operated by 21Vianet, set it tohttps://database.chinacloudapi.cn/.default. Soda rejects any other value.Create a database user for the managed identity in each pool or database Soda scans:
CREATE USER [<managed-identity-name>] FROM EXTERNAL PROVIDER;, then grant it read access as described in Required permissions.
Optional fields
driver
ODBC Driver 18 for SQL Server
Name of the installed ODBC driver.
encrypt
false
When true, Soda adds Encrypt=YES to the connection string. When false, Soda adds nothing and the driver's default applies. ODBC Driver 18 encrypts connections by default.
trust_server_certificate
false
When true, Soda adds TrustServerCertificate=YES. The connection stays encrypted, but the driver skips server certificate validation.
trusted_connection
false
When true, Soda adds Trusted_Connection=YES, which uses Windows integrated authentication (Kerberos on Linux and macOS). Not typically used with Synapse.
connection_max_retries
0
Sets the driver's ConnectRetryCount, the number of attempts to restore a broken idle connection. Soda always sends this value, so the default of 0 turns off reconnection.
login_timeout
0
Login timeout in seconds. 0 leaves the driver's default in place.
connection_parameters
None
Map of extra ODBC connection string keywords, appended as written.
Connection test
Test the data source connection by passing the path to your configuration file:
Required permissions
Soda needs read access to the data it scans and access to schema metadata. The statements differ between dedicated and serverless SQL pools. Run them as an administrator.
Dedicated SQL pool
Create a login in the master database:
Connect directly to the dedicated SQL pool database, then create the user and grant access. Dedicated SQL pools don't support the USE statement, so you must open a new connection to the pool database.
Serverless SQL pool
Create a login in the master database, then create the user in the target database:
If Soda scans external tables or views whose external data source uses a database scoped credential, grant REFERENCES on that credential:
If Soda scans views built on OPENROWSET, the user also needs permission to run bulk operations, whether or not the data source uses a credential:
If the underlying storage is accessed with the caller's own Microsoft Entra identity rather than a credential, that identity also needs read access on the storage account.
Microsoft Entra ID authentication
If you connect with an Entra ID user or service principal, don't create a login. Instead, create the database user from Entra ID, then run the same role and grant statements for your pool type:
Limitations & edge cases
Regex patterns in Synapse
Synapse databases do not offer universal regex support. When using regex-based checks in these environments, Soda adapts pattern-matching queries.
Instead of regex functions, Soda translates patterns into SQL queries using the PATINDEX function.
How Soda translates regex patterns
If the user specifies a regex pattern which matches a column expression, it will be expanded in SQL as:
Substring matching
Regex patterns are wrapped in %…%, so any substring match within the column value will return true.
Example: ^abc becomes %abc%, which will match anywhere in the string.
Collation
A collation (a rule set used for determining string matches) must be specified.
Soda uses the SQL_Latin1_General_Cp1_CS_AS, which is case-sensitive and accent-sensitive, so a and A are not equal, and accented characters (such as é) are treated distinctly.
Character ranges
In SQL Server and related databases, like Synapse, character range expansion for alpha characters is handled differently than in most regex engines.
Soda auto-expands the most common ranges for you:
[a-z]→[abcdefghijklmnopqrstuvwxyz][A-Z]→[ABCDEFGHIJKLMNOPQRSTUVWXYZ]
Other ranges are not expanded automatically and you may need to manually expand the full set when defining your pattern.
If you need
[0-9],[α-ω], or similar, you may have to manually expand them.Example: instead of
[0-9], write[0123456789].
Storage structure
Soda uses a Heap table storage structure in Synapse. Unlike indexed structures, Heap stores rows without predefined order or compression, which is required for compatibility with certain data types used in the warehouse (VARCHAR(MAX), TEXT, and XML) without character limits.
As a side effect, tables in the diagnostics warehouse may consume more storage than equivalent tables using columnar compression. This is expected behavior and a known trade-off of the current architecture.
Last updated
Was this helpful?
