Attribute
查看 MarkdownThis page lists the Python SDK names for Attributes. The doc comment of each API gives its parameters, defaults, and errors. Read them in the Python SDK API reference.
API names
| Task | Python API | Dex behavior |
|---|---|---|
| Define a singleton Attribute | Attribute | Attributes |
| Define an AttributeMap | AttributeMap | Attributes |
| Declare it in the Flow | PersistenceSchema.of, returned from get_persistence_schema | Flow definition |
| Read, write, and delete a value in a Step or RPC | get, set, and delete | Commits |
| Address one AttributeMap instance | AttributeMap.instance, or the instance key argument of get, set, and delete | Attributes |
| Count AttributeMap instances and list their keys | AttributeMap.get_map_size and AttributeMap.get_all_instance_keys | Selective state loading |
| Load AttributeMap values for a method | AttributeMap.load, with the load fields of StepOptions or @rpc | Selective state loading |
| Lock a value for a read-modify-write | lock, with the lock fields of StepOptions or lock_attributes of @rpc | Locks |
| Index a value for search | AttributeIndex and IndexType | Indexes |
| Project writes to an Attribute Store | sync_to_attribute_store | Attribute sync |
| Store a value that can be erased | hard_delete_on_null | Hard-delete Attributes |
| Set a value when the Flow starts | StartFlowOptions.with_attribute | Attributes at start |
| Read values from outside the Flow | Client.get_attributes | Read Attributes |
| Wait until a value matches | Client.wait_for_attribute_match | Wait for an Attribute match |
Example
Example: examples/python/dex_examples/primitives/attribute/attribute_flow.py