add tags to schema Level (#10381)

=
This commit is contained in:
Mohit Yadav 2023-03-06 12:45:07 +05:30 committed by GitHub
parent 1e3652d35e
commit df2001418e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -32,7 +32,7 @@ import org.openmetadata.service.util.EntityUtil.Fields;
import org.openmetadata.service.util.FullyQualifiedName;
public class DatabaseSchemaRepository extends EntityRepository<DatabaseSchema> {
private static final String DATABASE_SCHEMA_UPDATE_FIELDS = "owner";
private static final String DATABASE_SCHEMA_UPDATE_FIELDS = "owner,tags";
private static final String DATABASE_SCHEMA_PATCH_FIELDS = DATABASE_SCHEMA_UPDATE_FIELDS;
public DatabaseSchemaRepository(CollectionDAO dao) {
@ -77,6 +77,8 @@ public class DatabaseSchemaRepository extends EntityRepository<DatabaseSchema> {
addRelationship(
database.getId(), schema.getId(), database.getType(), Entity.DATABASE_SCHEMA, Relationship.CONTAINS);
storeOwner(schema, schema.getOwner());
// Add tag to databaseSchema relationship
applyTags(schema);
}
private List<EntityReference> getTables(DatabaseSchema schema) throws IOException {

View File

@ -78,7 +78,7 @@ class DatabaseSchemaResourceTest extends EntityResourceTest<DatabaseSchema, Crea
assertListNotNull(schema.getService(), schema.getServiceType(), schema.getDatabase());
assertListNull(schema.getOwner(), schema.getTables());
fields = "owner,tables";
fields = "owner,tags,tables";
schema =
byName
? getEntityByName(schema.getFullyQualifiedName(), fields, ADMIN_AUTH_HEADERS)

View File

@ -77,6 +77,14 @@
"$ref": "../../type/usageDetails.json",
"default": null
},
"tags": {
"description": "Tags for this Database Schema Service.",
"type": "array",
"items": {
"$ref": "../../type/tagLabel.json"
},
"default": null
},
"changeDescription": {
"description": "Change that lead to this version of the entity.",
"$ref": "../../type/entityHistory.json#/definitions/changeDescription"