Benefits of Using a Metadata Schema
Using a metadata schema provides several benefits:- Validation: Ensures that all custom metadata conforms to predefined data types, reducing errors during data registration and processing.
- Consistency: Maintains uniformity in data types across different datasets and projects, which simplifies data management and analysis.
- Filtering and Sorting: Enhances the ability to filter and sort data efficiently in the Encord platform, enabling more accurate and quick data retrieval.
Metadata Schema Table
Use .add_scalar() to add a scalar key to your metadata schema. You can pass the data type as a string (for example"varchar") or as a MetadataSchemaScalarType value from encord.metadata_schema.
Use .add_enum() to add an enum to your metadata schema, and .add_enum_options() to add options to an existing enum. An enum can have up to 255 options.
Use .add_embedding() to add an embedding to your metadata schema.
Use .add_geospatial() to add a new geospatial type to the metadata schema.
- Geospatial custom metadata is supported only in Curate.
- Geospatial custom metadata can be applied to all data unit types and on individual frames in videos.
Deprecated
Deprecated
While still supported, we STRONGLY RECOMMEND that you use the latest metadata schema instructions.
Import Your Metadata Schema to Encord
Importing a schema adds keys to your current schema. It does not remove keys that are not in your code. If you run the import code again, scalar keys are updated, but
add_enum, add_embedding, and add_geospatial raise MetadataSchemaError for keys that already exist. To change existing keys, see Add Enum Options, Edit Schema Keys, and Delete Schema Keys. Deprecated
Deprecated
This is supported, as is, we STRONGLY RECOMMEND that you use the most current method of creating your custom metadata schema.
Verify Your Schema
After importing your schema to Encord we recommend that you verify that the import is successful. Run the following code to verify your metadata schema imported and that the schema is correct. Deprecated
Deprecated
This is supported, as is, we STRONGLY RECOMMEND that you use the most current method of creating your custom metadata schema.
Inspect Schema Keys
Use the following methods to check individual keys in your schema:keys() lists all keys, has_key() checks whether a key is defined, is_key_deleted() checks whether a key has been deleted, get_key_type() returns a key’s data type (or None for a deleted key), and get_enum_options() and get_embedding_size() return the values of an enum key and the size of an embedding key.
Inspect schema keys
Add Enum Options
Use .add_enum_options() to add options to an existing enum key. The existing options are kept. The following example adds two options to theFruit enum.
Add Enum Options
Edit Schema Keys
You can change the data type of scalar schema keys (boolean, datetime, number, uuid, varchar, and text) using the .set_scalar() method. You cannot change an enum, embedding, or geospatial key into another type. The example below shows how to update the data type for multiple metadata fields.
Edit Schema Keys
Delete Schema Keys
You can delete schema keys using the .delete_key() method. There are two types of deletion: hard delete and soft delete. A hard delete permanently removes the key, making it impossible to restore. A soft delete allows you to restore the key later using the .restore_key() method. The following examples show hard delete and soft deletion of a schema key calledFruit.
Restore Schema Keys
Keys that have been soft deleted can be restored using the .restore_key() method. The following example restores a schema key calledFruit.
Restore Schema Key

