CodexBloom - Programming Q&A Platform

GCP Data Catalog API returns 'Invalid Request' when trying to update entry with incorrect schema

👀 Views: 86 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-10
gcp data-catalog api Python

I'm working with an scenario when trying to update an entry in Google Cloud Data Catalog using the Data Catalog API. After creating an entry with a specific schema, I attempted to update the entry with a new schema that slightly deviates from the original, and I'm receiving an 'Invalid Request' behavior. Here's the relevant code snippet: ```python from google.cloud import datacatalog_v1 client = datacatalog_v1.DataCatalogClient() entry = client.entry_path('my-project-id', 'my-location', 'my-entry-id') # Existing schema def existing_schema(): return datacatalog_v1.SchemaField( display_name='Field1', type_=datacatalog_v1.FieldType.STRING ) # New schema with a different type def new_schema(): return datacatalog_v1.SchemaField( display_name='Field1', type_=datacatalog_v1.FieldType.INT ) entry_update = datacatalog_v1.Entry( name=entry, schema=[new_schema()] ) try: client.update_entry(entry_update) except Exception as e: print(f'behavior: {e}') ``` The behavior message returned is `{'behavior': {'code': 400, 'message': 'Invalid Request'}}`. I verified that the entry ID and project ID are correct, and the previous schema is valid. I suspect the scenario is related to the schema change, but I need to find clear documentation on schema compatibility when updating entries in Data Catalog. I've also tried using the `update_entry` method with only the fields I want to change, but it still results in the same behavior. Are there specific requirements or limitations regarding schema updates in Data Catalog that I might be overlooking? Any help would be greatly appreciated!