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": {
@ -84,6 +102,11 @@
"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"
@ -168,6 +191,10 @@
"maxLength": 32
}
},
"required": ["id","name","storedProcedureCode"],
"required": [
"id",
"name",
"storedProcedureCode"
],
"additionalProperties": false
}