An error occurred (ValidationException) when calling the CreateAssetRevision operation: $.GlueTableForm: is missing but it is required

0

This code is working for some of the assets in datazone but giving error for some assets, Do I need to change code for according to the asset type? or what can I change to fix the error?

Content = f'{{"is_pii": true}}' response = client.create_asset_revision( domainIdentifier="dzd_c2gdn1vjw8kc2v", formsInput=[ { "content": Content, "formName": "Sensitive_Data", "typeIdentifier": "Sensitive_Data" }, ], identifier="ankza84706gl2f", name="macie_usecase_csv" )

Harsh
asked a month ago45 views
1 Answer
0

Why the Error Occurs:

**Asset-Specific Requirements: ** Different assets may have different required forms or fields. The GlueTableForm is mandatory for certain asset types, but not for others, which is why your code works for some assets and fails for others.

Possible Solutions:

Conditional Logic Based on Asset Type:

You can modify your code to include the GlueTableForm for assets that require it. You would need to detect the type of asset before making the API call and adjust the formsInput accordingly.

Content = f'{{"is_pii": true}}'
formsInput = [
    {
        "content": Content,
        "formName": "Sensitive_Data",
        "typeIdentifier": "Sensitive_Data"
    }
]

# Check the asset type and add GlueTableForm if necessary
asset_type = "specific_type_that_requires_glue_table_form"  # Replace with actual logic
if asset_type == "requires_glue_table_form":
    GlueTableFormContent = f'{{"glue_table_data": "your_data_here"}}'  # Replace with actual GlueTableForm content
    formsInput.append({
        "content": GlueTableFormContent,
        "formName": "GlueTableForm",
        "typeIdentifier": "GlueTableForm"
    })

response = client.create_asset_revision(
    domainIdentifier="dzd_c2gdn1vjw8kc2v",
    formsInput=formsInput,
    identifier="ankza84706gl2f",
    name="macie_usecase_csv"
)

Consult the Documentation or API Reference:

Review the documentation for the create_asset_revision API to understand the required fields for different asset types. This will give you a clearer idea of what forms are mandatory based on the asset.

Dynamic Form Construction:

If the asset type or required forms vary widely, consider constructing the formsInput dynamically based on asset metadata.

Next Steps:

Identify Asset Type: Determine how to identify the asset type in your script so you can conditionally add required forms.

**Add Required Forms: **Implement the conditional logic to add the GlueTableForm only when required.

EXPERT
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions