Skip to content

Commit

Permalink
Fix open-metadata#12078: Add clientSessionKeepAlive Field for snowfla…
Browse files Browse the repository at this point in the history
  • Loading branch information
ulixius9 authored Jun 23, 2023
1 parent b5c4d5a commit 258a2e3
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def get_connection(connection: SnowflakeConnection) -> Engine:
"""
Create connection
"""
if not connection.connectionArguments:
connection.connectionArguments = init_empty_connection_arguments()

if connection.privateKey:
snowflake_private_key_passphrase = (
connection.snowflakePrivatekeyPassphrase.get_secret_value()
Expand All @@ -120,10 +123,12 @@ def get_connection(connection: SnowflakeConnection) -> Engine:
encryption_algorithm=serialization.NoEncryption(),
)

if connection.privateKey:
if not connection.connectionArguments:
connection.connectionArguments = init_empty_connection_arguments()
connection.connectionArguments.__root__["private_key"] = pkb
connection.connectionArguments.__root__["private_key"] = pkb

if connection.clientSessionKeepAlive:
connection.connectionArguments.__root__[
"client_session_keep_alive"
] = connection.clientSessionKeepAlive

return create_generic_db_connection(
connection=connection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ This is a sample config for Snowflake:

{% /codeInfo %}

{% codeInfo srNumber=43 %}

**clientSessionKeepAlive**: Optional Configuration to keep the session active in case the ingestion job runs for longer duration.

{% /codeInfo %}

{% codeInfo srNumber=7 %}

**privateKey**: If you have configured the key pair authentication for the given user you will have to pass the private key associated with the user in this field. You can checkout [this](https://docs.snowflake.com/en/user-guide/key-pair-auth) doc to get more details about key-pair authentication.
Expand Down Expand Up @@ -271,6 +277,9 @@ source:
```yaml {% srNumber=6 %}
includeTempTables: false
```
```yaml {% srNumber=43 %}
clientSessionKeepAlive: false
```
```yaml {% srNumber=7 %}
# privateKey: <privateKey>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ This is a sample config for Snowflake:

{% /codeInfo %}

{% codeInfo srNumber=39 %}

**clientSessionKeepAlive**: Optional Configuration to keep the session active in case the ingestion job runs for longer duration.

{% /codeInfo %}

{% codeInfo srNumber=7 %}

**privateKey**: If you have configured the key pair authentication for the given user you will have to pass the private key associated with the user in this field. You can checkout [this](https://docs.snowflake.com/en/user-guide/key-pair-auth) doc to get more details about key-pair authentication.
Expand Down Expand Up @@ -271,6 +277,9 @@ source:
```yaml {% srNumber=6 %}
includeTempTables: false
```
```yaml {% srNumber=39 %}
clientSessionKeepAlive: false
```
```yaml {% srNumber=7 %}
# privateKey: <privateKey>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ desired.
- **Snowflake Passphrase Key (Optional)**: If you have configured the encrypted key pair authentication for the given user you will have to pass the paraphrase associated with the private key in this field. You can checkout [this](https://docs.snowflake.com/en/user-guide/key-pair-auth) doc to get more details about key-pair authentication.
- **Include Temporary and Transient Tables**:
Optional configuration for ingestion of `TRANSIENT` and `TEMPORARY` tables, By default, it will skip the `TRANSIENT` and `TEMPORARY` tables.
- **Client Session Keep Alive**: Optional Configuration to keep the session active in case the ingestion job runs for longer duration.
- **Connection Options (Optional)**: Enter the details for any additional connection options that can be sent to Snowflake during the connection. These details must be added as Key-Value pairs.
- **Connection Arguments (Optional)**: Enter the details for any additional connection arguments such as security or protocol configs that can be sent to Snowflake during the connection. These details must be added as Key-Value pairs.
- In case you are using Single-Sign-On (SSO) for authentication, add the `authenticator` details in the Connection Arguments as a Key-Value pair as follows: `"authenticator" : "sso_login_url"`
Expand Down Expand Up @@ -310,6 +311,7 @@ caption="Configure Metadata Ingestion Page" /%}
- **Include tags (toggle)**: Set the 'Include Tags' toggle to control whether to include tags as part of metadata ingestion.
- **Enable Debug Log (toggle)**: Set the Enable Debug Log toggle to set the default log level to debug, these logs can be viewed later in Airflow.


- **Mark Deleted Tables (toggle)**: Set the Mark Deleted Tables toggle to flag tables as soft-deleted if they are not present anymore in the source system.
- **Mark Deleted Tables from Filter Only (toggle)**: Set the Mark Deleted Tables from Filter Only toggle to flag tables as soft-deleted if they are not present anymore within the filtered schema or database only. This flag is useful when you have more than one ingestion pipelines. For example if you have a schema

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
"type": "boolean",
"default": false
},
"clientSessionKeepAlive": {
"title": "Client Session Keep Alive",
"description": "Optional configuration for ingestion to keep the client session active in case the ingestion process runs for longer durations.",
"type": "boolean",
"default": false
},
"connectionOptions": {
"title": "Connection Options",
"$ref": "../connectionBasicType.json#/definitions/connectionOptions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ In Snowflake, we also have `TRANSIENT` and `TEMPORARY` tables, which will be ign
Enable this setting to ingest them during the metadata workflow.
$$

$$section
### Client Session Keep Alive $(id="clientSessionKeepAlive")
Optional Configuration to keep the session active in case the ingestion job runs for longer duration.
$$

$$section
### Connection Options $(id="connectionOptions")
Expand Down

0 comments on commit 258a2e3

Please sign in to comment.