object_delimiter Property
The delimiter string to use when listing objects.
Syntax
def get_object_delimiter() -> str: ... def set_object_delimiter(value: str) -> None: ...
object_delimiter = property(get_object_delimiter, set_object_delimiter)
Default Value
""
Remarks
If this property is non-empty when list_objects or list_versions is called, any objects (or object versions) whose names contain the same string between the specified object_prefix and the first occurrence of the specified delimiter that follow will be rolled up into a "common prefix" element, which is returned in place of the individual objects themselves.
The on_prefix_list event will fire once for each common prefix returned. If the StorePrefixList configuration setting is enabled, the class will also populate the PrefixCount and Prefix[i] configuration settings
Object Hierarchy Traversal
By using the object_delimiter and object_prefix properties in tandem, applications can effectively "traverse" a virtual hierarchy of objects (or object versions) as if it were a filesystem. For example, assume that objects with the following names exist within a bucket:
- MyCompany/
- MyCompany/Department1/
- MyCompany/Department2/
- MyCompany/Department2/EmployeeA
- MyCompany/Department2/EmployeeB
With object_delimiter set to /, we can set object_prefix to successively "deeper" values before calling list_objects or list_versions for the following effect:
object_prefix Value | object_delimiter Value | Objects Returned | Prefixes Returned |
(empty) | / | (none) | MyCompany/ |
MyCompany/ | / | MyCompany/ | MyCompany/Department1/ MyCompany/Department2/ |
MyCompany/Department2/ | / | MyCompany/Department2/ MyCompany/Department2/EmployeeA MyCompany/Department2/EmployeeB | (none) |