All Projects → dbt-msft → Dbt Sqlserver

dbt-msft / Dbt Sqlserver

Licence: mit
dbt adapter for SQL Server and Azure SQL

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Dbt Sqlserver

DacFx
SQL Server database schema validation, deployment, and upgrade runtime. Enables declarative database development and database portability across SQL Server versions and environments.
Stars: ✭ 152 (+270.73%)
Mutual labels:  microsoft, sql-server
tsql-scripts
Transact-SQL scripts and gists
Stars: ✭ 35 (-14.63%)
Mutual labels:  sql-server, mssql
AlwaysEncryptedSample
Sample ASP.NET MVC Application for demonstrating Microsoft SQL Server Always Encrypted Functionality
Stars: ✭ 14 (-65.85%)
Mutual labels:  microsoft, sql-server
Node Mssql
Microsoft SQL Server client for Node.js
Stars: ✭ 1,951 (+4658.54%)
Mutual labels:  sql-server, mssql
Securitydriven.tinyorm
.NET micro ORM done right.
Stars: ✭ 281 (+585.37%)
Mutual labels:  sql-server, mssql
Msphpsql
Microsoft Drivers for PHP for SQL Server
Stars: ✭ 1,570 (+3729.27%)
Mutual labels:  microsoft, sql-server
Reservation-System
Airline Reservation System is an online Airline Ticket Reservation Application built using Windows Forms, C#, MS SQL Server.
Stars: ✭ 18 (-56.1%)
Mutual labels:  sql-server, mssql
SQLServerTools
This repo is the home of various SQL-Server-Tools
Stars: ✭ 28 (-31.71%)
Mutual labels:  microsoft, sql-server
YelpDatasetSQL
Working with the Yelp Dataset in Azure SQL and SQL Server
Stars: ✭ 16 (-60.98%)
Mutual labels:  sql-server, mssql
xelogstash
Send SQL Server Extended Events to Logstash, Elastic Search, or JSON
Stars: ✭ 22 (-46.34%)
Mutual labels:  sql-server, mssql
Tiberius
TDS 7.4 (mssql / Microsoft SQL Server) async driver for rust
Stars: ✭ 154 (+275.61%)
Mutual labels:  sql-server, mssql
Azuredatastudio
Azure Data Studio is a data management tool that enables working with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.
Stars: ✭ 6,605 (+16009.76%)
Mutual labels:  microsoft, sql-server
Dbatools
🚀 SQL Server automation and instance migrations have never been safer, faster or freer
Stars: ✭ 1,742 (+4148.78%)
Mutual labels:  sql-server, mssql
bizbook-server
The repository of bizbook server web api project
Stars: ✭ 45 (+9.76%)
Mutual labels:  sql-server, mssql
Prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite & MongoDB (Preview)
Stars: ✭ 18,168 (+44212.2%)
Mutual labels:  sql-server, mssql
uzbekistan-regions-data
Full Database of regions Uzbekistan available in JSON, SQL & CSV Format All Regions, Districts & Quarters with Latin, Cyrillic and Russian versions. (Районы (туманы) Республики Узбекистан и Города областного (республиканского) подчинения)
Stars: ✭ 46 (+12.2%)
Mutual labels:  sql-server, mssql
Pointblank
Data validation and organization of metadata for data frames and database tables
Stars: ✭ 480 (+1070.73%)
Mutual labels:  data-engineering, mssql
React Express Fullstack
Full stack (mostly unopinionated) starter pack with React+Redux and Expressjs
Stars: ✭ 23 (-43.9%)
Mutual labels:  sql-server, mssql
Windows Theme
Repository for Windows 10 community subreddit stylesheet and its assets.
Stars: ✭ 29 (-29.27%)
Mutual labels:  microsoft
Partnercenterpowershellmodule
Partner Center PowerShell Module
Stars: ✭ 35 (-14.63%)
Mutual labels:  microsoft

dbt-sqlserver

dbt adapter for sql server.

Passing all tests in dbt-integration-tests.

Only supports dbt 0.14 and newer!

  • For dbt 0.18.x use dbt-sqlserver 0.18.x
  • dbt 0.17.x is unsupported
  • dbt 0.16.x is unsupported
  • For dbt 0.15.x use dbt-sqlserver 0.15.x
  • For dbt 0.14.x use dbt-sqlserver 0.14.x

Easiest install is to use pip:

pip install dbt-sqlserver

On Ubuntu make sure you have the ODBC header files before installing

sudo apt install unixodbc-dev

Authentication

The following is needed for every target definition for both SQL Server and Azure SQL. The sections below details how to connect to SQL Server and Azure SQL specifically.

type: sqlserver
driver: 'ODBC Driver 17 for SQL Server' (The ODBC Driver installed on your system)
server: server-host-name or ip
port: 1433
schema: schemaname

Security

Encryption is not enabled by default, unless you specify it.

To enable encryption, add the following to your target definition. This is the default encryption strategy recommended by MSFT. For more information see this docs page

encrypt: true # adds "Encrypt=Yes" to connection string
trust_cert: false

For a fully-secure, encrypted connection, you must enable trust_cert: false because "TrustServerCertificate=Yes" is default for dbt-sqlserver in order to not break already defined targets.

standard SQL Server authentication

SQL Server credentials are supported for on-prem as well as cloud, and it is the default authentication method for dbt-sqlsever

user: username
password: password

Windows Authentication (SQL Server-specific)

windows_login: True

alternatively

trusted_connection: True

Azure SQL-specific auth

The following pyodbc-supported ActiveDirectory methods are available to authenticate to Azure SQL:

  • Azure CLI
  • ActiveDirectory Password
  • ActiveDirectory Interactive
  • ActiveDirectory Integrated
  • Service Principal (a.k.a. AAD Application)
  • ActiveDirectory MSI (not implemented)

However, the Azure CLI is the ideal way to authenticate instead of using the built-in ODBC ActiveDirectory methods, for reasons detailed below.

Azure CLI

Use the authentication of the Azure command line interface (CLI). First, install the Azure CLI, then, log in:

az login

Then, set authentication in profiles.yml to CLI:

authentication: CLI

This is also the preferred route for using a service principal:

az login --service-principal --username $CLIENTID --password $SECRET --tenant $TENANTID

This avoids storing a secret as plain text in profiles.yml.

Source: https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli#sign-in-using-a-service-principal

ActiveDirectory Password

Definitely not ideal, but available

authentication: ActiveDirectoryPassword
user: [email protected]
password: i<3opensource?

ActiveDirectory Interactive (Windows only)

brings up the Azure AD prompt so you can MFA if need be. The downside to this approach is that you must log in each time you run a dbt command!

authentication: ActiveDirectoryInteractive
user: [email protected]

ActiveDirectory Integrated (Windows only)

uses your machine's credentials (might be disabled by your AAD admins), also requires that you have Active Directory Federation Services (ADFS) installed and running, which is only the case if you have an on-prem Active Directory linked to your Azure AD...

authentication: ActiveDirectoryIntegrated
Service Principal

client_* and app_* can be used interchangeably. Again, it is not recommended to store a service principal secret in plain text in your dbt_profile.yml. The CLI auth method is preferred.

authentication: ServicePrincipal
tenant_id: tenatid
client_id: clientid
client_secret: clientsecret

Supported features

Materializations

  • Table:
    • Will be materialized as columns store index by default (requires SQL Server 2017 as least). (For Azure SQL requires Service Tier greater than S2) To override: {{ config( as_columnstore = false, ) }}
  • View
  • Incremental
  • Ephemeral

Seeds

Hooks

Custom schemas

Sources

Testing & documentation

  • Schema test supported
  • Data tests supported from dbt 0.14.1
  • Docs

Snapshots

  • Timestamp
  • Check

But, columns in source table can not have any constraints. If for example any column has a NOT NULL constraint, an error will be thrown.

DBT Utils

Many DBT utils macros are supported, but they require the addition of the tsql_utils dbt package.

You can find the package and installation instructions in the tsql-utils repo.

Indexes

There is now possible to define a regular sql server index on a table. This is best used when the default clustered columnstore index materialisation is not suitable. One reason would be that you need a large table that usually is queried one row at a time.

Clusterad and non-clustered index are supported:

  • create_clustered_index(columns, unique=False)
  • create_nonclustered_index(columns, includes=False)
  • drop_all_indexes_on_table(): Drops current indexex on a table. Only meaningfull if model is incremental.

Example of applying Unique clustered index on two columns, Ordinary index on one column, Ordinary index on one column with another column included

{{
    config({
        "as_columnstore": false, 
        "materialized": 'table',
        "post-hook": [
            "{{ create_clustered_index(columns = ['row_id', 'row_id_complement'], unique=True) }}",
            "{{ create_nonclustered_index(columns = ['modified_date']) }}",
            "{{ create_nonclustered_index(columns = ['row_id'], includes = ['modified_date']) }}",
        ]
    })
}}

Changelog

See the changelog

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].