MINOR: DB2 Support License (#18928)

This commit is contained in:
Mayur Singal 2024-12-05 09:54:58 +05:30 committed by GitHub
parent 46d4e1c77c
commit 6326ae3cb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 58 additions and 1 deletions

View File

@ -12,6 +12,7 @@
"""
Source connection handler
"""
from pathlib import Path
from typing import Optional
from sqlalchemy.engine import Engine
@ -32,13 +33,25 @@ from metadata.ingestion.connections.builders import (
)
from metadata.ingestion.connections.test_connections import test_connection_db_common
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.utils.constants import THREE_MIN
from metadata.utils.constants import THREE_MIN, UTF_8
def get_connection(connection: Db2Connection) -> Engine:
"""
Create connection
"""
# prepare license
# pylint: disable=import-outside-toplevel
if connection.license and connection.licenseFileName:
import clidriver
with open(
Path(clidriver.__path__[0], "license", connection.licenseFileName),
"w",
encoding=UTF_8,
) as file:
file.write(connection.license)
return create_generic_db_connection(
connection=connection,
get_connection_url_fn=get_connection_url_common,

View File

@ -87,6 +87,8 @@ Executing the profiler workflow or data quality tests, will require the user to
- **Password**: Password to connect to DB2.
- **database**: Database of the data source.
- **Host and Port**: Enter the fully qualified hostname and port number for your DB2 deployment in the Host and Port field.
- **License File Name**: License file name in case the license is required for connection.
- **License**: Contents of your license file if applicable, make sure to replace new lines with `\n` before pasting it here.
{% note %}
If you are using DB2 for IBM i:

View File

@ -108,6 +108,18 @@ This is a sample config for DB2:
{% /codeInfo %}
{% codeInfo srNumber=7 %}
**license**: Contents of your license file if applicable, make sure to replace new lines with `\n` before pasting it here.
{% /codeInfo %}
{% codeInfo srNumber=8 %}
**licenseFileName**: License file name in case the license is required for connection.
{% /codeInfo %}
{% partial file="/v1.6/connectors/yaml/database/source-config-def.md" /%}
{% partial file="/v1.6/connectors/yaml/ingestion-sink-def.md" /%}
@ -151,6 +163,12 @@ source:
```yaml {% srNumber=3 %}
hostPort: localhost:5432
```
```yaml {% srNumber=7 %}
# license: content.....\n..of your....\n...license...\n..file...
```
```yaml {% srNumber=8 %}
# licenseFileName: your_license.llc
```
```yaml {% srNumber=4 %}
# databaseSchema: schema
```

View File

@ -53,6 +53,16 @@
"description": "Database of the data source.",
"type": "string"
},
"licenseFileName": {
"title": "License File Name",
"description": "License file name to connect to DB2.",
"type": "string"
},
"license": {
"title": "License",
"description": "License to connect to DB2.",
"type": "string"
},
"connectionOptions": {
"title": "Connection Options",
"$ref": "../connectionBasicType.json#/definitions/connectionOptions"

View File

@ -69,6 +69,20 @@ $$section
Database name of the DB2 database to establish the connection.
$$
$$section
### License File Name $(id="licenseFileName")
License file name in case the license is required for connection.
$$
$$section
### License $(id="license")
Contents of your license file if applicable, make sure to replace new lines with `\n` before pasting it here.
$$
$$section
### Connection Options $(id="connectionOptions")