From 47c657a150931c6cbb649aea2cdfd27f12f50ba5 Mon Sep 17 00:00:00 2001 From: dat-a-man <98139823+dat-a-man@users.noreply.github.com> Date: Mon, 1 Apr 2024 05:30:07 +0000 Subject: [PATCH 1/3] Updated synapse documentation --- .../website/docs/dlt-ecosystem/destinations/synapse.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/website/docs/dlt-ecosystem/destinations/synapse.md b/docs/website/docs/dlt-ecosystem/destinations/synapse.md index ff46efb272..e91928e700 100644 --- a/docs/website/docs/dlt-ecosystem/destinations/synapse.md +++ b/docs/website/docs/dlt-ecosystem/destinations/synapse.md @@ -95,6 +95,16 @@ 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. 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=False) + ), + dataset_name='chess_data' +) +``` ## Write disposition All write dispositions are supported. From d53606c86dd81ba2a964daaf68d036da7a4cca0b Mon Sep 17 00:00:00 2001 From: dat-a-man <98139823+dat-a-man@users.noreply.github.com> Date: Wed, 10 Apr 2024 05:30:44 +0000 Subject: [PATCH 2/3] Added code snippets --- .../dlt-ecosystem/destinations/synapse.md | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/website/docs/dlt-ecosystem/destinations/synapse.md b/docs/website/docs/dlt-ecosystem/destinations/synapse.md index e91928e700..d57ff4cab6 100644 --- a/docs/website/docs/dlt-ecosystem/destinations/synapse.md +++ b/docs/website/docs/dlt-ecosystem/destinations/synapse.md @@ -95,7 +95,27 @@ 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. Once you have the connection URL, you can directly use it in your pipeline configuration or convert it to a string. +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', From e04221edde54da49de54db835d10c95c6dd332f8 Mon Sep 17 00:00:00 2001 From: Zaeem Athar Date: Mon, 15 Apr 2024 16:05:15 +0200 Subject: [PATCH 3/3] Update synapse.md Setting hide password property to `True` --- docs/website/docs/dlt-ecosystem/destinations/synapse.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/website/docs/dlt-ecosystem/destinations/synapse.md b/docs/website/docs/dlt-ecosystem/destinations/synapse.md index d57ff4cab6..4d249e3d35 100644 --- a/docs/website/docs/dlt-ecosystem/destinations/synapse.md +++ b/docs/website/docs/dlt-ecosystem/destinations/synapse.md @@ -120,7 +120,7 @@ Once you have the connection URL, you can directly use it in your pipeline confi pipeline = dlt.pipeline( pipeline_name='chess', destination=dlt.destinations.synapse( - credentials=connection_url.render_as_string(hide_password=False) + credentials=connection_url.render_as_string(hide_password=True) ), dataset_name='chess_data' )