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(), original.getStoredProcedureCode(),
updated.getStoredProcedureCode()); updated.getStoredProcedureCode());
} }
if (updated.getStoredProcedureType() != null) {
recordChange(
"storedProcedureType",
original.getStoredProcedureType(),
updated.getStoredProcedureType());
}
recordChange("sourceUrl", original.getSourceUrl(), updated.getSourceUrl()); recordChange("sourceUrl", original.getSourceUrl(), updated.getSourceUrl());
recordChange("sourceHash", original.getSourceHash(), updated.getSourceHash()); recordChange("sourceHash", original.getSourceHash(), updated.getSourceHash());
} }

View File

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

View File

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

View File

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