Creating Objects
You can create objects in three ways: through the UI, GraphQL mutations, or the Python SDK.- UI
- GraphQL
- Python SDK
- Navigate to the object type in the sidebar (e.g., Devices, Locations)
- Click Add [Object Type]
- Fill in the required attributes
- Set relationships by selecting existing objects
- Click Save
Updating Objects
Update existing objects by modifying their attributes or relationships.- UI
- GraphQL
- Python SDK
- Navigate to the object’s detail page
- Click Edit or click directly on editable fields
- Modify the values
- Click Save
Deleting Objects
Delete objects when they are no longer needed. Deletion is subject to relationship constraints.- UI
- GraphQL
- Python SDK
- Navigate to the object’s detail page
- Click the More actions menu (three dots)
- Select Delete
- Confirm the deletion
Working with Attributes
Attributes hold data values and support metadata like source tracking and validation.Setting Attribute Sources
You can specify where attribute values come from (e.g., a Profile or template):source field tracks provenance, while is_from_profile indicates if the value comes from a Profile.
Attribute Flags
is_default: True if using the schema’s default valueis_from_profile: True if value comes from a Profileis_protected: Prevents modificationis_visible: Controls UI visibility
Working with Relationships
Cardinality ONE
For single-value relationships, use{ id: "uuid" }:
Cardinality MANY
For multi-value relationships, provide an array:Using Human-Friendly Identifiers (HFID)
Instead of UUIDs, you can use HFIDs:Batch Operations
Create multiple objects efficiently using the SDK:Validation and Constraints
Infrahub validates objects against schema constraints:- Required attributes: Must have a value
- Unique attributes: Value must be unique across objects
- Regex patterns: String values must match patterns
- Min/max values: Numbers must be within range
- Relationship cardinality: ONE relationships require exactly one peer
Next Steps
- Learn about Data Import for bulk loading
- Explore Groups for organizing objects
- Use Profiles to apply common settings