feat(model): add created, lastModified auditstamps to SchemaField (#4943)

This commit is contained in:
mayurinehate 2022-05-25 11:21:26 +05:30 committed by GitHub
parent 34f099fbf7
commit 65cf0053a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 76 additions and 2 deletions

View File

@ -5749,14 +5749,20 @@ enum OperationType {
DELETE
"""
When data is created.
When table is created.
"""
CREATE
"""
When data is dropped
When table is altered
"""
ALTER
"""
When table is dropped
"""
DROP
"""
Unknown operation
"""

View File

@ -5,6 +5,7 @@ from datahub.emitter.rest_emitter import DatahubRestEmitter
# Imports for metadata model classes
from datahub.metadata.schema_classes import (
AuditStampClass,
ChangeTypeClass,
DateTypeClass,
OtherSchemaClass,
@ -25,24 +26,39 @@ event: MetadataChangeProposalWrapper = MetadataChangeProposalWrapper(
version=0, # when the source system has a notion of versioning of schemas, insert this in, otherwise leave as 0
hash="", # when the source system has a notion of unique schemas identified via hash, include a hash, else leave it as empty string
platformSchema=OtherSchemaClass(rawSchema="__insert raw schema here__"),
lastModified=AuditStampClass(
time=1640692800000, actor="urn:li:corpuser:ingestion"
),
fields=[
SchemaFieldClass(
fieldPath="address.zipcode",
type=SchemaFieldDataTypeClass(type=StringTypeClass()),
nativeDataType="VARCHAR(50)", # use this to provide the type of the field in the source system's vernacular
description="This is the zipcode of the address. Specified using extended form and limited to addresses in the United States",
lastModified=AuditStampClass(
time=1640692800000, actor="urn:li:corpuser:ingestion"
),
),
SchemaFieldClass(
fieldPath="address.street",
type=SchemaFieldDataTypeClass(type=StringTypeClass()),
nativeDataType="VARCHAR(100)",
description="Street corresponding to the address",
lastModified=AuditStampClass(
time=1640692800000, actor="urn:li:corpuser:ingestion"
),
),
SchemaFieldClass(
fieldPath="last_sold_date",
type=SchemaFieldDataTypeClass(type=DateTypeClass()),
nativeDataType="Date",
description="Date of the last sale date for this property",
created=AuditStampClass(
time=1640692800000, actor="urn:li:corpuser:ingestion"
),
lastModified=AuditStampClass(
time=1640692800000, actor="urn:li:corpuser:ingestion"
),
),
],
),

View File

@ -8,6 +8,7 @@ enum OperationType {
UPDATE
DELETE
CREATE
ALTER
DROP
UNKNOWN
}

View File

@ -3,6 +3,7 @@ namespace com.linkedin.schema
import com.linkedin.dataset.SchemaFieldPath
import com.linkedin.common.GlobalTags
import com.linkedin.common.GlossaryTerms
import com.linkedin.common.AuditStamp
/**
* SchemaField to describe metadata related to dataset schema.
@ -39,6 +40,16 @@ record SchemaField {
}
description: optional string
/**
* An AuditStamp corresponding to the creation of this schema field.
*/
created: optional AuditStamp
/**
* An AuditStamp corresponding to the last modification of this schema field.
*/
lastModified: optional AuditStamp
/**
* Platform independent field type of the field.
*/

View File

@ -2372,6 +2372,16 @@
"fieldName" : "fieldDescriptions",
"fieldType" : "TEXT"
}
}, {
"name" : "created",
"type" : "com.linkedin.common.AuditStamp",
"doc" : "An AuditStamp corresponding to the creation of this schema field.",
"optional" : true
}, {
"name" : "lastModified",
"type" : "com.linkedin.common.AuditStamp",
"doc" : "An AuditStamp corresponding to the last modification of this schema field.",
"optional" : true
}, {
"name" : "type",
"type" : {

View File

@ -2771,6 +2771,16 @@
"fieldName" : "fieldDescriptions",
"fieldType" : "TEXT"
}
}, {
"name" : "created",
"type" : "com.linkedin.common.AuditStamp",
"doc" : "An AuditStamp corresponding to the creation of this schema field.",
"optional" : true
}, {
"name" : "lastModified",
"type" : "com.linkedin.common.AuditStamp",
"doc" : "An AuditStamp corresponding to the last modification of this schema field.",
"optional" : true
}, {
"name" : "type",
"type" : {

View File

@ -2125,6 +2125,16 @@
"fieldName" : "fieldDescriptions",
"fieldType" : "TEXT"
}
}, {
"name" : "created",
"type" : "com.linkedin.common.AuditStamp",
"doc" : "An AuditStamp corresponding to the creation of this schema field.",
"optional" : true
}, {
"name" : "lastModified",
"type" : "com.linkedin.common.AuditStamp",
"doc" : "An AuditStamp corresponding to the last modification of this schema field.",
"optional" : true
}, {
"name" : "type",
"type" : {

View File

@ -2765,6 +2765,16 @@
"fieldName" : "fieldDescriptions",
"fieldType" : "TEXT"
}
}, {
"name" : "created",
"type" : "com.linkedin.common.AuditStamp",
"doc" : "An AuditStamp corresponding to the creation of this schema field.",
"optional" : true
}, {
"name" : "lastModified",
"type" : "com.linkedin.common.AuditStamp",
"doc" : "An AuditStamp corresponding to the last modification of this schema field.",
"optional" : true
}, {
"name" : "type",
"type" : {