Configures dbt to run models against a Microsoft SQL Server database by adding a SQLServer profile and required adapter.
Install Python 3.8+, dbt-core ≥1.6, and the SQL Server adapter: pip install dbt-sqlserver
. Make sure the target database allows TCP connections and that the service account has CREATE TABLE permission.
profiles.yml
?Create or open ~/.dbt/profiles.yml
. Add a profile name (e.g., sqlserver_ecommerce
) and a target (e.g., dev
) using the syntax shown below.Save the file and keep credentials secure with environment variables when possible.
You must specify type
, driver
, server
, port
, database
, schema
, user
, and password
. Optional fields such as encrypt
or trust_cert
enhance security.
Run dbt debug --target dev --profile sqlserver_ecommerce
. A successful run confirms network reachability, authentication, and permission to query system tables.
Switch to your dbt project directory.Use dbt run --target dev --profile sqlserver_ecommerce
to compile and materialize models in SQL Server. Jinja macros, ref(), and source() all work identically.
Keep development and production targets isolated. Use dedicated schemas such as analytics_dev
and analytics_prod
. Leverage incremental models for large fact tables and always define unique keys to avoid full-table rebuilds.
.
Yes. Omit user
and password
, then add authentication: windows
. Ensure the dbt runner has proper domain rights.
Absolutely. Use the same adapter, set encrypt: true
, and configure trust_cert
as recommended by Microsoft.