mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-18 14:06:59 +00:00
* change deprecationwarning * fix format python * fix replace module * change : java function name
This commit is contained in:
parent
69318d3e67
commit
49fceb4674
@ -49,8 +49,10 @@ class DatalakeGcsClient(DatalakeBaseClient):
|
|||||||
if hasattr(config.securityConfig, "gcpConfig") and isinstance(
|
if hasattr(config.securityConfig, "gcpConfig") and isinstance(
|
||||||
config.securityConfig.gcpConfig.projectId, MultipleProjectId
|
config.securityConfig.gcpConfig.projectId, MultipleProjectId
|
||||||
):
|
):
|
||||||
gcs_config.securityConfig.gcpConfig.projectId = SingleProjectId.parse_obj(
|
gcs_config.securityConfig.gcpConfig.projectId = (
|
||||||
gcs_config.securityConfig.gcpConfig.projectId.root[0]
|
SingleProjectId.model_validate(
|
||||||
|
gcs_config.securityConfig.gcpConfig.projectId.root[0]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not gcs_config.securityConfig:
|
if not gcs_config.securityConfig:
|
||||||
@ -89,8 +91,8 @@ class DatalakeGcsClient(DatalakeBaseClient):
|
|||||||
gcs_config = deepcopy(config)
|
gcs_config = deepcopy(config)
|
||||||
|
|
||||||
if hasattr(gcs_config.securityConfig, "gcpConfig"):
|
if hasattr(gcs_config.securityConfig, "gcpConfig"):
|
||||||
gcs_config.securityConfig.gcpConfig.projectId = SingleProjectId.parse_obj(
|
gcs_config.securityConfig.gcpConfig.projectId = (
|
||||||
database_name
|
SingleProjectId.model_validate(database_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
self._client = self.get_gcs_client(gcs_config)
|
self._client = self.get_gcs_client(gcs_config)
|
||||||
|
@ -240,7 +240,7 @@ class DatalakeSource(DatabaseServiceSource):
|
|||||||
verbose=False,
|
verbose=False,
|
||||||
)
|
)
|
||||||
content = json.loads(metadata_config_response)
|
content = json.loads(metadata_config_response)
|
||||||
metadata_entry = StorageContainerConfig.parse_obj(content)
|
metadata_entry = StorageContainerConfig.model_validate(content)
|
||||||
except ReadException:
|
except ReadException:
|
||||||
metadata_entry = None
|
metadata_entry = None
|
||||||
if self.source_config.includeTables:
|
if self.source_config.includeTables:
|
||||||
|
@ -87,7 +87,7 @@ class GcsSource(StorageServiceSource):
|
|||||||
def create(
|
def create(
|
||||||
cls, config_dict, metadata: OpenMetadata, pipeline_name: Optional[str] = None
|
cls, config_dict, metadata: OpenMetadata, pipeline_name: Optional[str] = None
|
||||||
):
|
):
|
||||||
config: WorkflowSource = WorkflowSource.parse_obj(config_dict)
|
config: WorkflowSource = WorkflowSource.model_validate(config_dict)
|
||||||
connection: GcsConnection = config.serviceConnection.root.config
|
connection: GcsConnection = config.serviceConnection.root.config
|
||||||
if not isinstance(connection, GcsConnection):
|
if not isinstance(connection, GcsConnection):
|
||||||
raise InvalidSourceException(
|
raise InvalidSourceException(
|
||||||
@ -451,7 +451,7 @@ class GcsSource(StorageServiceSource):
|
|||||||
verbose=False,
|
verbose=False,
|
||||||
)
|
)
|
||||||
content = json.loads(response_object)
|
content = json.loads(response_object)
|
||||||
metadata_config = StorageContainerConfig.parse_obj(content)
|
metadata_config = StorageContainerConfig.model_validate(content)
|
||||||
return metadata_config
|
return metadata_config
|
||||||
except ReadException:
|
except ReadException:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
|
@ -333,24 +333,22 @@ class OMetaCustomAttributeTest(TestCase):
|
|||||||
for custom_property in custom_properties:
|
for custom_property in custom_properties:
|
||||||
if expected_custom_property["name"] == custom_property["name"]:
|
if expected_custom_property["name"] == custom_property["name"]:
|
||||||
actual_custom_properties.append(custom_property)
|
actual_custom_properties.append(custom_property)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
custom_property["name"], expected_custom_property["name"]
|
custom_property["name"], expected_custom_property["name"]
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
custom_property["description"],
|
custom_property["description"],
|
||||||
expected_custom_property["description"],
|
expected_custom_property["description"],
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
custom_property.get("customPropertyConfig"),
|
custom_property.get("customPropertyConfig"),
|
||||||
expected_custom_property.get("customPropertyConfig"),
|
expected_custom_property.get("customPropertyConfig"),
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
custom_property["propertyType"]["name"],
|
custom_property["propertyType"]["name"],
|
||||||
expected_custom_property["propertyType"]["name"],
|
expected_custom_property["propertyType"]["name"],
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEqual(len(actual_custom_properties), len(EXPECTED_CUSTOM_PROPERTIES))
|
||||||
len(actual_custom_properties), len(EXPECTED_CUSTOM_PROPERTIES)
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_add_custom_property_table(self):
|
def test_add_custom_property_table(self):
|
||||||
"""
|
"""
|
||||||
|
@ -102,7 +102,7 @@ def test_source_config(parameters, expected, monkeypatch):
|
|||||||
)
|
)
|
||||||
|
|
||||||
source = TestSuiteSource(
|
source = TestSuiteSource(
|
||||||
OpenMetadataWorkflowConfig.parse_obj(workflow_config), mock_metadata
|
OpenMetadataWorkflowConfig.model_validate(workflow_config), mock_metadata
|
||||||
)
|
)
|
||||||
test_cases = list(source._iter())[0].right.test_cases
|
test_cases = list(source._iter())[0].right.test_cases
|
||||||
assert [t.name.root for t in test_cases] == expected
|
assert [t.name.root for t in test_cases] == expected
|
||||||
|
@ -284,7 +284,7 @@ class TestAthenaService(unittest.TestCase):
|
|||||||
def __init__(self, methodName, test_connection) -> None:
|
def __init__(self, methodName, test_connection) -> None:
|
||||||
super().__init__(methodName)
|
super().__init__(methodName)
|
||||||
test_connection.return_value = False
|
test_connection.return_value = False
|
||||||
self.config = OpenMetadataWorkflowConfig.parse_obj(mock_athena_config)
|
self.config = OpenMetadataWorkflowConfig.model_validate(mock_athena_config)
|
||||||
self.athena_source = AthenaSource.create(
|
self.athena_source = AthenaSource.create(
|
||||||
mock_athena_config["source"],
|
mock_athena_config["source"],
|
||||||
self.config.workflowConfig.openMetadataServerConfig,
|
self.config.workflowConfig.openMetadataServerConfig,
|
||||||
|
@ -37,7 +37,7 @@ class TopologyContextManagerTest(TestCase):
|
|||||||
|
|
||||||
def test_main_thread_is_set_correctly(self):
|
def test_main_thread_is_set_correctly(self):
|
||||||
"""Asserts self.main_thread is set accordingly."""
|
"""Asserts self.main_thread is set accordingly."""
|
||||||
self.assertEquals(self.manager.main_thread, MAIN_THREAD)
|
self.assertEqual(self.manager.main_thread, MAIN_THREAD)
|
||||||
|
|
||||||
def test_get_returns_correct_context(self):
|
def test_get_returns_correct_context(self):
|
||||||
"""Asserts get and get_global returns the correct context even on a different thread."""
|
"""Asserts get and get_global returns the correct context even on a different thread."""
|
||||||
@ -49,8 +49,8 @@ class TopologyContextManagerTest(TestCase):
|
|||||||
|
|
||||||
self.manager.get_global().database = MOCK_DATABASE_NAME
|
self.manager.get_global().database = MOCK_DATABASE_NAME
|
||||||
|
|
||||||
self.assertEquals(self.manager.get().database, None)
|
self.assertEqual(self.manager.get().database, None)
|
||||||
self.assertEquals(self.manager.get_global().database, MOCK_DATABASE_NAME)
|
self.assertEqual(self.manager.get_global().database, MOCK_DATABASE_NAME)
|
||||||
|
|
||||||
def test_thread_is_created_correctly(self):
|
def test_thread_is_created_correctly(self):
|
||||||
"""Asserts copy_from copies correctly the context from parent thread."""
|
"""Asserts copy_from copies correctly the context from parent thread."""
|
||||||
@ -64,7 +64,7 @@ class TopologyContextManagerTest(TestCase):
|
|||||||
self.manager.copy_from(MAIN_THREAD)
|
self.manager.copy_from(MAIN_THREAD)
|
||||||
|
|
||||||
# Check we are retrieving the right thread
|
# Check we are retrieving the right thread
|
||||||
self.assertEquals(self.manager.get().database, MOCK_DATABASE_NAME)
|
self.assertEqual(self.manager.get().database, MOCK_DATABASE_NAME)
|
||||||
|
|
||||||
def test_pop_removes_the_correct_thread(self):
|
def test_pop_removes_the_correct_thread(self):
|
||||||
"""Asserts pop removes the correct thread and not another one."""
|
"""Asserts pop removes the correct thread and not another one."""
|
||||||
@ -72,10 +72,10 @@ class TopologyContextManagerTest(TestCase):
|
|||||||
with patch("threading.get_ident", return_value=OTHER_THREAD):
|
with patch("threading.get_ident", return_value=OTHER_THREAD):
|
||||||
self.manager.copy_from(MAIN_THREAD)
|
self.manager.copy_from(MAIN_THREAD)
|
||||||
|
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
list(self.manager.contexts.keys()), [MAIN_THREAD, OTHER_THREAD]
|
list(self.manager.contexts.keys()), [MAIN_THREAD, OTHER_THREAD]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.manager.pop(OTHER_THREAD)
|
self.manager.pop(OTHER_THREAD)
|
||||||
|
|
||||||
self.assertEquals(list(self.manager.contexts.keys()), [MAIN_THREAD])
|
self.assertEqual(list(self.manager.contexts.keys()), [MAIN_THREAD])
|
||||||
|
@ -64,7 +64,7 @@ def create(
|
|||||||
config_dict: dict,
|
config_dict: dict,
|
||||||
metadata_config: OpenMetadataConnection
|
metadata_config: OpenMetadataConnection
|
||||||
):
|
):
|
||||||
config: WorkflowSource = WorkflowSource.parse_obj(config_dict)
|
config: WorkflowSource = WorkflowSource.model_validate(config_dict)
|
||||||
.....
|
.....
|
||||||
.....
|
.....
|
||||||
return cls(config, metadata_config)
|
return cls(config, metadata_config)
|
||||||
@ -79,7 +79,7 @@ def create(
|
|||||||
metadata_config: OpenMetadataConnection,
|
metadata_config: OpenMetadataConnection,
|
||||||
pipeline_name: Optional[str] = None
|
pipeline_name: Optional[str] = None
|
||||||
):
|
):
|
||||||
config: WorkflowSource = WorkflowSource.parse_obj(config_dict)
|
config: WorkflowSource = WorkflowSource.model_validate(config_dict)
|
||||||
.....
|
.....
|
||||||
.....
|
.....
|
||||||
return cls(config, metadata_config)
|
return cls(config, metadata_config)
|
||||||
|
@ -65,7 +65,7 @@ def create(
|
|||||||
config_dict: dict,
|
config_dict: dict,
|
||||||
metadata_config: OpenMetadataConnection
|
metadata_config: OpenMetadataConnection
|
||||||
):
|
):
|
||||||
config: WorkflowSource = WorkflowSource.parse_obj(config_dict)
|
config: WorkflowSource = WorkflowSource.model_validate(config_dict)
|
||||||
.....
|
.....
|
||||||
.....
|
.....
|
||||||
return cls(config, metadata_config)
|
return cls(config, metadata_config)
|
||||||
@ -80,7 +80,7 @@ def create(
|
|||||||
metadata_config: OpenMetadataConnection,
|
metadata_config: OpenMetadataConnection,
|
||||||
pipeline_name: Optional[str] = None
|
pipeline_name: Optional[str] = None
|
||||||
):
|
):
|
||||||
config: WorkflowSource = WorkflowSource.parse_obj(config_dict)
|
config: WorkflowSource = WorkflowSource.model_validate(config_dict)
|
||||||
.....
|
.....
|
||||||
.....
|
.....
|
||||||
return cls(config, metadata_config)
|
return cls(config, metadata_config)
|
||||||
|
@ -65,7 +65,7 @@ def create(
|
|||||||
config_dict: dict,
|
config_dict: dict,
|
||||||
metadata_config: OpenMetadataConnection
|
metadata_config: OpenMetadataConnection
|
||||||
):
|
):
|
||||||
config: WorkflowSource = WorkflowSource.parse_obj(config_dict)
|
config: WorkflowSource = WorkflowSource.model_validate(config_dict)
|
||||||
.....
|
.....
|
||||||
.....
|
.....
|
||||||
return cls(config, metadata_config)
|
return cls(config, metadata_config)
|
||||||
@ -80,7 +80,7 @@ def create(
|
|||||||
metadata_config: OpenMetadataConnection,
|
metadata_config: OpenMetadataConnection,
|
||||||
pipeline_name: Optional[str] = None
|
pipeline_name: Optional[str] = None
|
||||||
):
|
):
|
||||||
config: WorkflowSource = WorkflowSource.parse_obj(config_dict)
|
config: WorkflowSource = WorkflowSource.model_validate(config_dict)
|
||||||
.....
|
.....
|
||||||
.....
|
.....
|
||||||
return cls(config, metadata_config)
|
return cls(config, metadata_config)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user