get_field
Retrieve a single or multiple fields from a single record selected by its primary key.
#
ParametersProperty name | Required | Accepted types | Default | Description |
---|---|---|---|---|
key_value | YES | Any | - | The path expression to target the attribute to set/update in your record. See Field path selectors |
field_path | YES | str | - | The path expression to target the attribute to set/update in your record. See Field path selectors |
query_kwargs | NO | dict | None | Used to pass data to populate a field_path that contains keys. See example below : |
data_validation | NO | bool | True | Whether data validation from your table model should be applied on the retrieved data. |
#
AvailabilityTable | Available |
---|---|
DynamoDBBasicTable | ✅ |
DynamoDBCachingTable | ✅ |
ExternalDynamoDBApiBasicTable | ✅ |
ExternalDynamoDBApiCachingTable | ✅ |
#
Single field retrieving#
Queried record#
Code#
Output#
Multi fields selectorsIf you need to access multiple items that share the same location, you can use a multi-selector. In the field_path
specify the attributes you want to retrieved by enclosing them in brackets and with a comma separating each attribute.
For example : myItem.(attribute1, attribute2, attribute3)
tip
A single database request will be constructed and send to retrieve your multiple attributes. It is then more efficient
to use multi selectors or the get_multiple_fields
operation as much as you can,
instead of sending multiple operations to your database to retrieve the data you need.
You cannot use a multi-selector to get multiple fields that are not in the same location. For that use case, you need
the get_multiple_fields
operation.