Hi, I’m currently trying to replace schema field d...
# troubleshoot
w
Hi, I’m currently trying to replace schema field descriptions in the UI with a transformer. I want to selectively replace fields with the source content and override user input. I’m using EditableSchemaFieldInfoClass for the fields which should be overwritten. However, after ingestion all descriptions have been set back to the source values, instead of the selection defined in the recipe for my transformer. Are the Editable classes the wrong approach here? Thanks in advance for any help!
g
Hey Yannick! EditableSchemaFieldInfo should be the right aspect for this. Are you sure you are populating it properly? What does an example snapshot look like?
w
Hey, thanks for the quick response! I’m using the same approach as shown in the docs for building a transformer from scratch:
Copy code
fields = builder.get_or_add_aspect(
    mce, EditableSchemaMetadataClass(editableSchemaFieldInfo=[])
)
And appending every specified field in the recipe in a loop:
Copy code
fields.editableSchemaFieldInfo.extend(
    [
        EditableSchemaFieldInfoClass(
            field,
            description=f"{schema_field[0].description}",
        )
    ]
)
Here is a snippet of the snapshot, in which any changes made to the description of the field “version” should be overwritten with the source content:
Copy code
SchemaMetadataClass(
    {
        "schemaName": "...",
        "platform": "urn:li:dataPlatform:bigquery",
        "version": 0,
        "created": AuditStampClass(
            {
                "time": 0,
                "actor": "urn:li:corpuser:unknown",
                "impersonator": None,
            }
        ),
        "lastModified": AuditStampClass(
            {
                "time": 0,
                "actor": "urn:li:corpuser:unknown",
                "impersonator": None,
            }
        ),
        "deleted": None,
        "dataset": None,
        "cluster": None,
        "hash": "",
        "platformSchema": MySqlDDLClass({"tableSchema": ""}),
        "fields": [
            SchemaFieldClass(
                {
                    "fieldPath": "id",
                    "jsonPath": None,
                    "nullable": True,
                    "description": None,
                    "type": SchemaFieldDataTypeClass({"type": NumberTypeClass({})}),
                    "nativeDataType": "INTEGER",
                    "recursive": False,
                    "globalTags": None,
                    "glossaryTerms": None,
                    "isPartOfKey": False,
                }
            ),
            SchemaFieldClass(
                {
                    "fieldPath": "name",
                    "jsonPath": None,
                    "nullable": True,
                    "description": None,
                    "type": SchemaFieldDataTypeClass({"type": StringTypeClass({})}),
                    "nativeDataType": "STRING",
                    "recursive": False,
                    "globalTags": None,
                    "glossaryTerms": None,
                    "isPartOfKey": False,
                }
            ),
            SchemaFieldClass(
                {
                    "fieldPath": "version",
                    "jsonPath": None,
                    "nullable": True,
                    "description": "source information",
                    "type": SchemaFieldDataTypeClass({"type": NumberTypeClass({})}),
                    "nativeDataType": "INTEGER",
                    "recursive": False,
                    "globalTags": None,
                    "glossaryTerms": None,
                    "isPartOfKey": False,
                }
            ),
        ],
        "primaryKeys": None,
        "foreignKeysSpecs": None,
    }
),
EditableSchemaMetadataClass(
    {
        "created": AuditStampClass(
            {
                "time": 0,
                "actor": "urn:li:corpuser:unknown",
                "impersonator": None,
            }
        ),
        "lastModified": AuditStampClass(
            {
                "time": 0,
                "actor": "urn:li:corpuser:unknown",
                "impersonator": None,
            }
        ),
        "deleted": None,
        "editableSchemaFieldInfo": [
            EditableSchemaFieldInfoClass(
                {
                    "fieldPath": "version",
                    "description": "source information",
                    "globalTags": None,
                }
            )
        ],
    }
)
g
That looks correct. I do notice that the edited description you are "overwriting" version with is the same as the original description- was that your intention? That might be why you aren't seeing a different description.