arcticdb.version_store.library.Library
- class arcticdb.version_store.library.Library(arctic_instance_description: str, nvs: NativeVersionStore)[source]
The main interface exposing read/write functionality within a given Arctic instance.
Arctic libraries contain named symbols which are the atomic unit of data storage within Arctic. Symbols contain data that in most cases resembles a DataFrame and are versioned such that all modifying operations can be tracked and reverted.
Instances of this class provide a number of primitives to write, modify and remove symbols, as well as also providing methods to manage library snapshots. For more information on snapshots please see the snapshot method.
Arctic libraries support concurrent writes and reads to multiple symbols as well as concurrent reads to a single symbol. However, concurrent writers to a single symbol are not supported other than for primitives that explicitly state support for single-symbol concurrent writes.
- __init__(arctic_instance_description: str, nvs: NativeVersionStore)[source]
- Parameters:
arctic_instance_description – Human readable description of the Arctic instance to which this library belongs. Used for informational purposes only.
nvs – The native version store that backs this library.
Methods
__init__
(arctic_instance_description, nvs)- param arctic_instance_description:
Human readable description of the Arctic instance to which this library belongs. Used for informational
append
(symbol, data[, metadata, ...])Appends the given data to the existing, stored data.
append_batch
(append_payloads[, ...])Append data to multiple symbols in a batch fashion. This is more efficient than making multiple append calls in succession as some constant-time operations can be executed only once rather than once for each element of append_payloads. Note that this isn't an atomic operation - it's possible for one symbol to be fully written and readable before another symbol. :param append_payloads: Symbols and their corresponding data. There must not be any duplicate symbols in append_payloads. :type append_payloads: List[WritePayload] :param prune_previous_versions: Removes previous (non-snapshotted) versions from the database. :type prune_previous_versions: bool, default=False :param validate_index: If set to True, it will verify for each entry in the batch whether the index of the data supports date range searches and update operations. This in effect tests that the data is sorted in ascending order. ArcticDB relies on Pandas to detect if data is sorted - you can call DataFrame.index.is_monotonic_increasing on your input DataFrame to see if Pandas believes the data to be sorted :type validate_index: bool, default=False.
defragment_symbol_data
(symbol[, segment_size])Compacts fragmented segments by merging row-sliced segments (https://docs.arcticdb.io/technical/on_disk_storage/#data-layer).
delete
(symbol[, versions])Delete all versions of the symbol from the library, unless
version
is specified, in which case only those versions are deleted.delete_data_in_range
(symbol, date_range)Delete data within the given date range, creating a new version of
symbol
.delete_snapshot
(snapshot_name)Delete a named snapshot.
finalize_staged_data
(symbol[, mode, ...])Finalises staged data, making it available for reads.
get_description
(symbol[, as_of])Returns descriptive data for
symbol
.get_description_batch
(symbols)Returns descriptive data for a list of
symbols
.Returns all symbols with staged, unfinalized data.
has_symbol
(symbol[, as_of])Whether this library contains the given symbol.
head
(symbol[, n, as_of, columns])Read the first n rows of data for the named symbol.
is_symbol_fragmented
(symbol[, segment_size])Check whether the number of segments that would be reduced by compaction is more than or equal to the value specified by the configuration option "SymbolDataCompact.SegmentCount" (defaults to 100).
List the snapshots in the library.
list_symbols
([snapshot_name])Return the symbols in this library.
list_versions
([symbol, snapshot, ...])Get the versions in this library, filtered by the passed in parameters.
prune_previous_versions
(symbol)Removes all (non-snapshotted) versions from the database for the given symbol, except the latest.
read
(symbol[, as_of, date_range, columns, ...])Read data for the named symbol.
read_batch
(symbols[, query_builder])Reads multiple symbols.
read_metadata
(symbol[, as_of])Return the metadata saved for a symbol.
read_metadata_batch
(symbols)Reads the metadata of multiple symbols.
Forces the symbol list cache to be reloaded.
snapshot
(snapshot_name[, metadata, ...])Creates a named snapshot of the data within a library.
sort_and_finalize_staged_data
(symbol[, mode])sort_merge will sort and finalize staged data.
tail
(symbol[, n, as_of, columns])Read the last n rows of data for the named symbol.
update
(symbol, data[, metadata, upsert, ...])Overwrites existing symbol data with the contents of
data
.write
(symbol, data[, metadata, ...])Write
data
to the specifiedsymbol
.write_batch
(payloads[, ...])Write a batch of multiple symbols.
write_metadata
(symbol, metadata)Write metadata under the specified symbol name to this library.
write_metadata_batch
(write_metadata_payloads)Write metadata to multiple symbols in a batch fashion.
write_pickle
(symbol, data[, metadata, ...])See write.
write_pickle_batch
(payloads[, ...])Write a batch of multiple symbols, pickling their data if necessary.
Attributes
The name of this library.