MINOR: Add UDF support for SP - backend (#18767)

This commit is contained in:
Mayur Singal 2024-11-25 15:27:53 +05:30 committed by GitHub
parent 4b9e214078
commit 40a70357e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 52 additions and 14 deletions

View File

@ -138,6 +138,12 @@ public class StoredProcedureRepository extends EntityRepository<StoredProcedure>
original.getStoredProcedureCode(),
updated.getStoredProcedureCode());
}
if (updated.getStoredProcedureType() != null) {
recordChange(
"storedProcedureType",
original.getStoredProcedureType(),
updated.getStoredProcedureType());
}
recordChange("sourceUrl", original.getSourceUrl(), updated.getSourceUrl());
recordChange("sourceHash", original.getSourceHash(), updated.getSourceHash());
}

View File

@ -533,6 +533,7 @@ public class StoredProcedureResource
.copy(new StoredProcedure(), create, user)
.withDatabaseSchema(getEntityReference(Entity.DATABASE_SCHEMA, create.getDatabaseSchema()))
.withStoredProcedureCode(create.getStoredProcedureCode())
.withStoredProcedureType(create.getStoredProcedureType())
.withSourceUrl(create.getSourceUrl())
.withSourceHash(create.getSourceHash());
}

View File

@ -38,6 +38,10 @@
"description": "SQL Query definition.",
"$ref": "../../entity/data/storedProcedure.json#/definitions/storedProcedureCode"
},
"storedProcedureType": {
"description": "Type of the Stored Procedure.",
"$ref": "../../entity/data/storedProcedure.json#/definitions/storedProcedureType"
},
"databaseSchema": {
"description": "Link to the database schema fully qualified name where this stored procedure is hosted in",
"$ref": "../../type/basic.json#/definitions/fullyQualifiedEntityName"

View File

@ -8,6 +8,24 @@
"javaType": "org.openmetadata.schema.entity.data.StoredProcedure",
"javaInterfaces": ["org.openmetadata.schema.EntityInterface"],
"definitions": {
"storedProcedureType": {
"javaType": "org.openmetadata.schema.type.StoredProcedureType",
"description": "This schema defines the type of the type of Procedures",
"type": "string",
"default": "StoredProcedure",
"enum": [
"StoredProcedure",
"UDF"
],
"javaEnums": [
{
"name": "StoredProcedure"
},
{
"name": "UDF"
}
]
},
"storedProcedureCode": {
"properties": {
"language": {
@ -76,14 +94,19 @@
"description": "Metadata version of the Stored Procedure.",
"$ref": "../../type/entityHistory.json#/definitions/entityVersion"
},
"dataProducts" : {
"dataProducts": {
"description": "List of data products this entity is part of.",
"$ref" : "../../type/entityReferenceList.json"
"$ref": "../../type/entityReferenceList.json"
},
"updatedAt": {
"description": "Last update time corresponding to the new version of the entity in Unix epoch time milliseconds.",
"$ref": "../../type/basic.json#/definitions/timestamp"
},
"storedProcedureType": {
"description": "Type of the Stored Procedure.",
"$ref": "#/definitions/storedProcedureType",
"default": "StoredProcedure"
},
"updatedBy": {
"description": "User who made the query.",
"type": "string"
@ -104,14 +127,14 @@
"description": "Reference to Database that contains this stored procedure.",
"$ref": "../../type/entityReference.json"
},
"service": {
"description": "Link to Database service this table is hosted in.",
"$ref": "../../type/entityReference.json"
},
"serviceType": {
"description": "Service type this table is hosted in.",
"$ref": "../services/databaseService.json#/definitions/databaseServiceType"
},
"service": {
"description": "Link to Database service this table is hosted in.",
"$ref": "../../type/entityReference.json"
},
"serviceType": {
"description": "Service type this table is hosted in.",
"$ref": "../services/databaseService.json#/definitions/databaseServiceType"
},
"deleted": {
"description": "When `true` indicates the entity has been soft deleted.",
"type": "boolean",
@ -126,7 +149,7 @@
"description": "Followers of this Stored Procedure.",
"$ref": "../../type/entityReferenceList.json"
},
"votes" : {
"votes": {
"description": "Votes on the entity.",
"$ref": "../../type/votes.json"
},
@ -150,7 +173,7 @@
"description": "Source URL of database schema.",
"$ref": "../../type/basic.json#/definitions/sourceUrl"
},
"domain" : {
"domain": {
"description": "Domain the Stored Procedure belongs to. When not set, the Stored Procedure inherits the domain from the database schemna it belongs to.",
"$ref": "../../type/entityReference.json"
},
@ -168,6 +191,10 @@
"maxLength": 32
}
},
"required": ["id","name","storedProcedureCode"],
"required": [
"id",
"name",
"storedProcedureCode"
],
"additionalProperties": false
}
}