Fix Hive & DB2 (#4147)

This commit is contained in:
Mayur Singal 2022-04-14 22:57:05 +05:30 committed by GitHub
parent 2e04204af9
commit c48bc18065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 29 deletions

View File

@ -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.",

View File

@ -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.",

View File

@ -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)

View File

@ -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)

View File

@ -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}"

View File

@ -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",

View File

@ -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.",

View File

@ -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.",