Skip to content

Commit

Permalink
Merge pull request #1167 from dlt-hub/docs/adding-info-to-synapse-docs
Browse files Browse the repository at this point in the history
docs/updated synapse documentation
  • Loading branch information
zem360 authored Apr 15, 2024
2 parents f5a6dbd + e04221e commit cdb8d5e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/website/docs/dlt-ecosystem/destinations/synapse.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,36 @@ pipeline = dlt.pipeline(
dataset_name='chess_data'
)
```
To use **Active Directory Principal**, you can use the `sqlalchemy.engine.URL.create` method to create the connection URL using your Active Directory Service Principal credentials. First create the connection string as:
```py
conn_str = (
f"DRIVER={{ODBC Driver 18 for SQL Server}};"
f"SERVER={server_name};"
f"DATABASE={database_name};"
f"UID={service_principal_id}@{tenant_id};"
f"PWD={service_principal_secret};"
f"Authentication=ActiveDirectoryServicePrincipal"
)
```

Next, create the connection URL:
```py
connection_url = URL.create(
"mssql+pyodbc",
query={"odbc_connect": conn_str}
)
```

Once you have the connection URL, you can directly use it in your pipeline configuration or convert it to a string.
```py
pipeline = dlt.pipeline(
pipeline_name='chess',
destination=dlt.destinations.synapse(
credentials=connection_url.render_as_string(hide_password=True)
),
dataset_name='chess_data'
)
```

## Write disposition
All write dispositions are supported.
Expand Down

0 comments on commit cdb8d5e

Please sign in to comment.