-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into create-admin-page-fix
- Loading branch information
Showing
318 changed files
with
4,386 additions
and
571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
# Created by .ignore support plugin (hsz.mobi) | ||
# Maven | ||
.venv | ||
__pycache__ | ||
target/ | ||
pom.xml.tag | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
87 changes: 87 additions & 0 deletions
87
ingestion/src/metadata/ingestion/source/database/exasol/connection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
from typing import Optional | ||
from urllib.parse import quote_plus | ||
|
||
from pydantic import SecretStr | ||
from sqlalchemy.engine import Engine | ||
|
||
from metadata.generated.schema.entity.automations.workflow import ( | ||
Workflow as AutomationWorkflow, | ||
) | ||
from metadata.generated.schema.entity.services.connections.database.exasolConnection import ( | ||
ExasolConnection, | ||
) | ||
from metadata.ingestion.connections.builders import ( | ||
create_generic_db_connection, | ||
get_connection_args_common, | ||
) | ||
from metadata.ingestion.connections.test_connections import test_query | ||
from metadata.ingestion.ometa.ometa_api import OpenMetadata | ||
from metadata.utils.logger import ingestion_logger | ||
|
||
logger = ingestion_logger() | ||
|
||
|
||
def get_connection_url(connection: ExasolConnection) -> str: | ||
""" | ||
Common method for building the source connection urls | ||
""" | ||
|
||
url = f"{connection.scheme.value}://" | ||
|
||
if connection.username: | ||
url += f"{quote_plus(connection.username)}" | ||
connection.password = ( | ||
SecretStr("") if not connection.password else connection.password | ||
) | ||
url += ( | ||
f":{quote_plus(connection.password.get_secret_value())}" | ||
if connection | ||
else "" | ||
) | ||
url += "@" | ||
|
||
url += connection.hostPort | ||
|
||
if hasattr(connection, "databaseSchema"): | ||
url += f"/{connection.databaseSchema}" if connection.databaseSchema else "" | ||
|
||
tls_settings = { | ||
"validate-certificate": {}, | ||
"ignore-certificate": {"SSLCertificate": "SSL_VERIFY_NONE"}, | ||
"disable-tls": {"SSLCertificate": "SSL_VERIFY_NONE", "ENCRYPTION": "no"}, | ||
} | ||
options = tls_settings[connection.tls.value] | ||
if options: | ||
if (hasattr(connection, "database") and not connection.database) or ( | ||
hasattr(connection, "databaseSchema") and not connection.databaseSchema | ||
): | ||
url += "/" | ||
params = "&".join( | ||
f"{key}={quote_plus(value)}" for (key, value) in options.items() if value | ||
) | ||
url = f"{url}?{params}" | ||
return url | ||
|
||
|
||
def get_connection(connection: ExasolConnection) -> Engine: | ||
""" | ||
Create connection | ||
""" | ||
return create_generic_db_connection( | ||
connection=connection, | ||
get_connection_url_fn=get_connection_url, | ||
get_connection_args_fn=get_connection_args_common, | ||
) | ||
|
||
|
||
def test_connection( | ||
metadata: OpenMetadata, | ||
engine: Engine, | ||
service_connection: ExasolConnection, | ||
automation_workflow: Optional[AutomationWorkflow] = None, | ||
) -> None: | ||
""" | ||
Test connection. This can be executed either as part | ||
of a metadata workflow or during an Automation Workflow | ||
""" | ||
test_query(engine, "SELECT 1;") |
27 changes: 27 additions & 0 deletions
27
ingestion/src/metadata/ingestion/source/database/exasol/metadata.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from typing import Optional, cast | ||
|
||
from metadata.generated.schema.entity.services.connections.database.exasolConnection import ( | ||
ExasolConnection, | ||
) | ||
from metadata.generated.schema.metadataIngestion.workflow import ( | ||
Source as WorkflowSource, | ||
) | ||
from metadata.ingestion.api.steps import InvalidSourceException | ||
from metadata.ingestion.ometa.ometa_api import OpenMetadata | ||
from metadata.ingestion.source.database.common_db_source import CommonDbSourceService | ||
|
||
|
||
class ExasolSource(CommonDbSourceService): | ||
@classmethod | ||
def create( | ||
cls, config_dict, metadata: OpenMetadata, pipeline_name: Optional[str] = None | ||
): | ||
config: WorkflowSource = WorkflowSource.model_validate(config_dict) | ||
if config.serviceConnection is None: | ||
raise InvalidSourceException("Missing service connection") | ||
connection = cast(ExasolConnection, config.serviceConnection.root.config) | ||
if not isinstance(connection, ExasolConnection): | ||
raise InvalidSourceException( | ||
f"Expected ExasolConnection, but got {connection}" | ||
) | ||
return cls(config, metadata) |
4 changes: 4 additions & 0 deletions
4
ingestion/src/metadata/ingestion/source/database/exasol/service_spec.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from metadata.ingestion.source.database.exasol.metadata import ExasolSource | ||
from metadata.utils.service_spec.default import DefaultDatabaseSpec | ||
|
||
ServiceSpec = DefaultDatabaseSpec(metadata_source_class=ExasolSource) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.