mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-07 13:07:22 +00:00
Fixed Db2 source config (#3978)
Co-authored-by: Onkar Ravgan <onkarravgan@Onkars-MacBook-Pro.local>
This commit is contained in:
parent
a92dff15e6
commit
d5758b2fb2
@ -1,26 +1,26 @@
|
||||
{
|
||||
"source": {
|
||||
"type": "db2",
|
||||
"source": {
|
||||
"type": "db2",
|
||||
"serviceName": "local_db2",
|
||||
"serviceConnection": {
|
||||
"config": {
|
||||
"username": "db2inst1",
|
||||
"password": "password",
|
||||
"database": "metadata",
|
||||
"service_name": "local_db2",
|
||||
"table_filter_pattern": {
|
||||
"excludes": []
|
||||
}
|
||||
"type": "Db2",
|
||||
"username": "openmetadata_user",
|
||||
"password": "openmetadata_password",
|
||||
"hostPort": "localhost:50000",
|
||||
"database": "custom_database_name"
|
||||
}
|
||||
},
|
||||
"sink": {
|
||||
"type": "metadata-rest",
|
||||
"config": {}
|
||||
},
|
||||
"metadata_server": {
|
||||
"type": "metadata-server",
|
||||
"config": {
|
||||
"api_endpoint": "http://localhost:8585/api",
|
||||
"auth_provider_type": "no-auth"
|
||||
}
|
||||
"sourceConfig": {"config": {"enableDataProfiler": false}}
|
||||
},
|
||||
"sink": {
|
||||
"type": "metadata-rest",
|
||||
"config": {}
|
||||
},
|
||||
"workflowConfig": {
|
||||
"openMetadataServerConfig": {
|
||||
"hostPort": "http://localhost:8585/api",
|
||||
"authProvider": "no-auth"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -15,8 +15,11 @@ from sqlalchemy.engine import reflection
|
||||
from metadata.generated.schema.metadataIngestion.workflow import (
|
||||
OpenMetadataServerConfig,
|
||||
)
|
||||
from metadata.generated.schema.metadataIngestion.workflow import (
|
||||
Source as WorkflowSource,
|
||||
)
|
||||
from metadata.ingestion.api.source import InvalidSourceException
|
||||
from metadata.ingestion.source.sql_source import SQLSource
|
||||
from metadata.ingestion.source.sql_source_common import SQLConnectionConfig
|
||||
|
||||
|
||||
@reflection.cache
|
||||
@ -30,16 +33,16 @@ from metadata.generated.schema.entity.services.connections.database.db2Connectio
|
||||
)
|
||||
|
||||
|
||||
class Db2Config(DB2Connection, SQLConnectionConfig):
|
||||
def get_connection_url(self):
|
||||
return super().get_connection_url()
|
||||
|
||||
|
||||
class Db2Source(SQLSource):
|
||||
def __init__(self, config, metadata_config):
|
||||
super().__init__(config, metadata_config)
|
||||
|
||||
@classmethod
|
||||
def create(cls, config_dict, metadata_config: OpenMetadataServerConfig):
|
||||
config = Db2Config.parse_obj(config_dict)
|
||||
config: WorkflowSource = WorkflowSource.parse_obj(config_dict)
|
||||
connection: DB2Connection = config.serviceConnection.__root__.config
|
||||
if not isinstance(connection, DB2Connection):
|
||||
raise InvalidSourceException(
|
||||
f"Expected DB2Connection, but got {connection}"
|
||||
)
|
||||
return cls(config, metadata_config)
|
||||
|
||||
@ -22,6 +22,9 @@ from metadata.generated.schema.entity.services.connections.database.clickhouseCo
|
||||
from metadata.generated.schema.entity.services.connections.database.databricksConnection import (
|
||||
DatabricksConnection,
|
||||
)
|
||||
from metadata.generated.schema.entity.services.connections.database.db2Connection import (
|
||||
DB2Connection,
|
||||
)
|
||||
from metadata.generated.schema.entity.services.connections.database.hiveConnection import (
|
||||
HiveSQLConnection,
|
||||
)
|
||||
@ -97,6 +100,7 @@ def get_connection_url(connection):
|
||||
@get_connection_url.register(ClickhouseConnection)
|
||||
@get_connection_url.register(SingleStoreConnection)
|
||||
@get_connection_url.register(VerticaConnection)
|
||||
@get_connection_url.register(DB2Connection)
|
||||
def _(connection):
|
||||
return get_connection_url_common(connection)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user