-
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.
Fix 14040: Part 2 Add Patch Request when updating the entities from c…
…reate request (#14224)
- Loading branch information
Showing
61 changed files
with
597 additions
and
40 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
120 changes: 120 additions & 0 deletions
120
ingestion/src/metadata/ingestion/models/patch_request.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,120 @@ | ||
# Copyright 2021 Collate | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
""" | ||
Pydantic definition for storing entities for patching | ||
""" | ||
from pydantic import BaseModel | ||
|
||
from metadata.ingestion.api.models import Entity | ||
|
||
|
||
class PatchRequest(BaseModel): | ||
""" | ||
Store the original and new entities for patch | ||
""" | ||
|
||
original_entity: Entity | ||
new_entity: Entity | ||
|
||
|
||
ALLOWED_COLUMN_FIELDS = { | ||
"name": True, | ||
"displayName": True, | ||
"dataType": True, | ||
"arrayDataType": True, | ||
"dataLength": True, | ||
"constraint": True, | ||
"children": True, | ||
"ordinalPosition": True, | ||
"precision": True, | ||
"scale": True, | ||
"dataTypeDisplay": True, | ||
"jsonSchema": True, | ||
} | ||
|
||
ALLOWED_TASK_FIELDS = { | ||
"name": True, | ||
"displayName": True, | ||
"sourceUrl": True, | ||
"downstreamTasks": True, | ||
"taskType": True, | ||
"taskSQL": True, | ||
"startDate": True, | ||
"endDate": True, | ||
} | ||
|
||
ALLOWED_ENTITY_REFERENCE_FIELDS = {"id": True, "type": True} | ||
|
||
ALLOWED_CONTAINER_DATAMODEL_FIELDS = { | ||
"isPartitioned": True, | ||
"columns": {"__all__": ALLOWED_COLUMN_FIELDS}, | ||
} | ||
|
||
ALLOWED_COMMON_PATCH_FIELDS = { | ||
# Common Entity Fields | ||
"name": True, | ||
"displayName": True, | ||
"sourceUrl": True, | ||
# Table Entity Fields | ||
"tableType": True, | ||
"columns": {"__all__": ALLOWED_COLUMN_FIELDS}, | ||
"tableConstraints": True, | ||
"tablePartition": True, | ||
"location": True, | ||
"viewDefinition": True, | ||
"sampleData": True, | ||
"retentionPeriod": True, | ||
"fileFormat": True, | ||
# Stored Procedure Fields | ||
"storedProcedureCode": True, | ||
"code": True, | ||
# Dashboard Entity Fields | ||
"chartType": True, | ||
"project": True, | ||
"dashboardType": True, | ||
"charts": {"__all__": ALLOWED_ENTITY_REFERENCE_FIELDS}, | ||
"dataModels": {"__all__": ALLOWED_ENTITY_REFERENCE_FIELDS}, | ||
# Pipeline Entity Fields | ||
"concurrency": True, | ||
"pipelineLocation": True, | ||
"startDate": True, | ||
"scheduleInterval": True, | ||
"tasks": {"__all__": ALLOWED_TASK_FIELDS}, | ||
# Topic Entity Fields | ||
"messageSchema": True, | ||
"partitions": True, | ||
"cleanupPolicies": True, | ||
"retentionTime": True, | ||
"replicationFactor": True, | ||
"maximumMessageSize": True, | ||
"minimumInSyncReplicas": True, | ||
"retentionSize": True, | ||
"topicConfig": True, | ||
# MlModel Entity Fields | ||
"algorithm": True, | ||
"mlFeatures": True, | ||
"mlHyperParameters": True, | ||
"target": True, | ||
"dashboard": ALLOWED_ENTITY_REFERENCE_FIELDS, | ||
"mlStore": True, | ||
"server": True, | ||
# SearchIndex Entity Fields | ||
"fields": {"__all__": ALLOWED_COLUMN_FIELDS}, | ||
"searchIndexSettings": True, | ||
# Container Entity Fields | ||
"parent": ALLOWED_ENTITY_REFERENCE_FIELDS, | ||
"children": {"__all__": ALLOWED_ENTITY_REFERENCE_FIELDS}, | ||
"dataModel": ALLOWED_CONTAINER_DATAMODEL_FIELDS, | ||
"prefix": True, | ||
"numberOfObjects": True, | ||
"size": True, | ||
"fileFormats": True, | ||
} |
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.