atmos.store
The atmos.store function runs atmos store through the current Atmos executable. Use it to read, write,
delete, and list values in the store backends configured under stores: in atmos.yaml from automation.
Usage
atmos.store(
*positionals,
flags = {},
args = [],
working_directory = ...,
env = ...,
output = "stream",
check = True,
)
Subcommands
Pass the subcommand and any positional arguments as strings before the keyword arguments. The call
atmos.store("get", "app-metadata", "release") runs atmos store get app-metadata release.
| Subcommand | Purpose |
|---|---|
get | Retrieve a value from a store. |
set | Write a value to a store (create or update). |
delete | Remove a value from a store. Also available as rm and unset. |
list | List configured store backends, or the key/value pairs stored inside one. |
See the atmos store command reference for the complete list of subcommands and flags.
Arguments
*positionals(Optional) Strings placed on the command line right after
store, in order: the subcommand and its positional arguments. These are the store name, the key, and forsetthe value. Every value must be a string.flags(Optional) A dictionary of command-line options; see flag translation. A bare key such as
"format"becomes--format, and registered shorthands such as"s","c", and"f"resolve to their long form. Common keys for this command are"stack","component","identity","format", and"force".args- (Optional) A list or tuple of strings appended after the flags.
working_directory,env,output,check(Optional) See
atmos.runfor process options and defaults.
Options other than the positionals are keyword-only.
Returns
A result with stdout, stderr, and exit_code. See atmos.run for output and error behavior.
Examples
Write a value to a store
atmos.store("set", "app-metadata", "release", "v1.4.0")
Read a value back
release = atmos.store("get", "app-metadata", "release", flags = {"raw": True}, output = "capture")
ui.info("Current release: " + release.stdout)
The raw flag prints the value with no trailing newline.
List the configured backends as data
listing = atmos.store("list", flags = {"format": "json"}, output = "capture")
if listing.stdout.strip():
print(json.decode(listing.stdout))
else:
ui.warning("No stores are configured in atmos.yaml.")
Delete a key without confirmation
atmos.store("delete", "app-metadata", "release", flags = {"force": True})
Notes
The atmos store command is experimental. The wrappers keep its native behavior, including the experimental notice on
standard error and authentication through the backend identity. The delete subcommand asks for confirmation unless
force is set, so scripts pass force. Pass the value to set as a positional argument rather than with the stdin
flag.
Related
atmos.runruns any Atmos command from an argument list.atmos storedocuments every subcommand and flag.- Atmos Automation Language and the script step