From c48bc1806563f9847e089b7255ae034fa2e7df06 Mon Sep 17 00:00:00 2001 From: Mayur Singal <39544459+ulixius9@users.noreply.github.com> Date: Thu, 14 Apr 2022 22:57:05 +0530 Subject: [PATCH] Fix Hive & DB2 (#4147) --- .../services/connections/database/db2Connection.json | 6 +++--- .../services/connections/database/hiveConnection.json | 6 +++--- ingestion/src/metadata/ingestion/source/db2.py | 8 ++++---- ingestion/src/metadata/ingestion/source/hive.py | 10 +++++----- ingestion/src/metadata/utils/source_connections.py | 8 ++++---- ingestion/tests/unit/test_source_connection.py | 6 +++--- .../connections/database/db2Connection.json | 6 +++--- .../connections/database/hiveConnection.json | 8 ++++---- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/database/db2Connection.json b/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/database/db2Connection.json index fd67ae58e63..c1f7e67db11 100644 --- a/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/database/db2Connection.json +++ b/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/database/db2Connection.json @@ -1,10 +1,10 @@ { "$id": "https://open-metadata.org/schema/entity/services/connections/database/db2Connection.json", "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DB2Connection", - "description": "DB2 Connection Config", + "title": "Db2Connection", + "description": "Db2 Connection Config", "type": "object", - "javaType": "org.openmetadata.catalog.services.connections.database.DB2Connection", + "javaType": "org.openmetadata.catalog.services.connections.database.Db2Connection", "definitions": { "db2Type": { "description": "Service type.", diff --git a/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/database/hiveConnection.json b/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/database/hiveConnection.json index 0cd7c073855..0cf463f2a8e 100644 --- a/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/database/hiveConnection.json +++ b/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/database/hiveConnection.json @@ -1,10 +1,10 @@ { - "$id": "https://open-metadata.org/schema/entity/services/connections/database/hiveSQLConnection.json", + "$id": "https://open-metadata.org/schema/entity/services/connections/database/hiveConnection.json", "$schema": "http://json-schema.org/draft-07/schema#", - "title": "HiveSQLConnection", + "title": "HiveConnection", "description": "Hive SQL Connection Config", "type": "object", - "javaType": "org.openmetadata.catalog.services.connections.database.HiveSQLConnection", + "javaType": "org.openmetadata.catalog.services.connections.database.HiveConnection", "definitions": { "hiveType": { "description": "Service type.", diff --git a/ingestion/src/metadata/ingestion/source/db2.py b/ingestion/src/metadata/ingestion/source/db2.py index 4aeacf90580..7f91f582acd 100644 --- a/ingestion/src/metadata/ingestion/source/db2.py +++ b/ingestion/src/metadata/ingestion/source/db2.py @@ -29,7 +29,7 @@ def get_pk_constraint(self, bind, table_name, schema=None, **kw): DB2Dialect.get_pk_constraint = get_pk_constraint from metadata.generated.schema.entity.services.connections.database.db2Connection import ( - DB2Connection, + Db2Connection, ) @@ -40,9 +40,9 @@ class Db2Source(SQLSource): @classmethod def create(cls, config_dict, metadata_config: OpenMetadataConnection): config: WorkflowSource = WorkflowSource.parse_obj(config_dict) - connection: DB2Connection = config.serviceConnection.__root__.config - if not isinstance(connection, DB2Connection): + connection: Db2Connection = config.serviceConnection.__root__.config + if not isinstance(connection, Db2Connection): raise InvalidSourceException( - f"Expected DB2Connection, but got {connection}" + f"Expected Db2Connection, but got {connection}" ) return cls(config, metadata_config) diff --git a/ingestion/src/metadata/ingestion/source/hive.py b/ingestion/src/metadata/ingestion/source/hive.py index e085a82e20f..6dbfb88ef7d 100644 --- a/ingestion/src/metadata/ingestion/source/hive.py +++ b/ingestion/src/metadata/ingestion/source/hive.py @@ -74,7 +74,7 @@ HiveDialect.get_table_names = get_table_names from metadata.generated.schema.entity.services.connections.database.hiveConnection import ( - HiveSQLConnection, + HiveConnection, ) from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import ( OpenMetadataConnection, @@ -92,10 +92,10 @@ class HiveSource(SQLSource): @classmethod def create(cls, config_dict, metadata_config: OpenMetadataConnection): - config: HiveSQLConnection = WorkflowSource.parse_obj(config_dict) - connection: HiveSQLConnection = config.serviceConnection.__root__.config - if not isinstance(connection, HiveSQLConnection): + config: HiveConnection = WorkflowSource.parse_obj(config_dict) + connection: HiveConnection = config.serviceConnection.__root__.config + if not isinstance(connection, HiveConnection): raise InvalidSourceException( - f"Expected HiveSQLConnection, but got {connection}" + f"Expected HiveConnection, but got {connection}" ) return cls(config, metadata_config) diff --git a/ingestion/src/metadata/utils/source_connections.py b/ingestion/src/metadata/utils/source_connections.py index a8f74e20f04..0e391678b63 100644 --- a/ingestion/src/metadata/utils/source_connections.py +++ b/ingestion/src/metadata/utils/source_connections.py @@ -29,10 +29,10 @@ from metadata.generated.schema.entity.services.connections.database.databricksCo DatabricksConnection, ) from metadata.generated.schema.entity.services.connections.database.db2Connection import ( - DB2Connection, + Db2Connection, ) from metadata.generated.schema.entity.services.connections.database.hiveConnection import ( - HiveSQLConnection, + HiveConnection, ) from metadata.generated.schema.entity.services.connections.database.mariaDBConnection import ( MariaDBConnection, @@ -116,7 +116,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) +@get_connection_url.register(Db2Connection) def _(connection): return get_connection_url_common(connection) @@ -245,7 +245,7 @@ def _(connection: SnowflakeConnection): @get_connection_url.register -def _(connection: HiveSQLConnection): +def _(connection: HiveConnection): url = get_connection_url_common(connection) if connection.authOptions: return f"{url};{connection.authOptions}" diff --git a/ingestion/tests/unit/test_source_connection.py b/ingestion/tests/unit/test_source_connection.py index b1a8c5d3a14..3997ec0766d 100644 --- a/ingestion/tests/unit/test_source_connection.py +++ b/ingestion/tests/unit/test_source_connection.py @@ -17,8 +17,8 @@ from metadata.generated.schema.entity.services.connections.database.databricksCo DatabricksScheme, ) from metadata.generated.schema.entity.services.connections.database.hiveConnection import ( + HiveConnection, HiveScheme, - HiveSQLConnection, ) from metadata.generated.schema.entity.services.connections.database.trinoConnection import ( TrinoConnection, @@ -53,14 +53,14 @@ class SouceConnectionTest(TestCase): def test_hive_url(self): expected_result = "hive://localhost:10000/default" - databricks_conn_obj = HiveSQLConnection( + databricks_conn_obj = HiveConnection( scheme=HiveScheme.hive, hostPort="localhost:10000", database="default" ) assert expected_result == get_connection_url(databricks_conn_obj) def test_hive_url_auth(self): expected_result = "hive://localhost:10000/default;auth=CUSTOM" - databricks_conn_obj = HiveSQLConnection( + databricks_conn_obj = HiveConnection( scheme=HiveScheme.hive, hostPort="localhost:10000", database="default", diff --git a/openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/database/db2Connection.json b/openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/database/db2Connection.json index 2aa601933e6..0a81da643be 100644 --- a/openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/database/db2Connection.json +++ b/openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/database/db2Connection.json @@ -1,10 +1,10 @@ { "$id": "https://open-metadata.org/schema/entity/services/connections/database/db2Connection.json", "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DB2Connection", - "description": "DB2 Connection Config", + "title": "Db2Connection", + "description": "Db2 Connection Config", "type": "object", - "javaType": "org.openmetadata.catalog.services.connections.database.DB2Connection", + "javaType": "org.openmetadata.catalog.services.connections.database.Db2Connection", "definitions": { "db2Type": { "description": "Service type.", diff --git a/openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/database/hiveConnection.json b/openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/database/hiveConnection.json index 29b96bbe74b..36ec5a2fe84 100644 --- a/openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/database/hiveConnection.json +++ b/openmetadata-ui/src/main/resources/ui/src/jsons/connectionSchemas/connections/database/hiveConnection.json @@ -1,10 +1,10 @@ { - "$id": "https://open-metadata.org/schema/entity/services/connections/database/hiveSQLConnection.json", + "$id": "https://open-metadata.org/schema/entity/services/connections/database/hiveConnection.json", "$schema": "http://json-schema.org/draft-07/schema#", - "title": "HiveSQLConnection", - "description": "Hive SQL Connection Config", + "title": "HiveConnection", + "description": "Hive Connection Config", "type": "object", - "javaType": "org.openmetadata.catalog.services.connections.database.HiveSQLConnection", + "javaType": "org.openmetadata.catalog.services.connections.database.HiveConnection", "definitions": { "hiveType": { "description": "Service type.",