tiledbsoma.SOMATileDBContext¶
- class tiledbsoma.SOMATileDBContext(tiledb_ctx: Ctx | None = None, tiledb_config: Dict[str, str | float] | None = None, timestamp: int | datetime | None = None, threadpool: ThreadPoolExecutor | None = None)¶
Maintains TileDB-specific context for TileDB-SOMA objects. This context can be shared across multiple objects, including having a child object inherit it from its parent.
Treat this as immutable. Only code internal to the
_soma_tiledb_contextmodule should be modifying this. Use thereplacemethod to construct a newSOMATileDBContextwith new values.Lifecycle
Experimental.
- __init__(tiledb_ctx: Ctx | None = None, tiledb_config: Dict[str, str | float] | None = None, timestamp: int | datetime | None = None, threadpool: ThreadPoolExecutor | None = None) None¶
Initializes a new SOMATileDBContext.
Either
tiledb_ctxortiledb_configmay be provided, or both may be left at their default. If neither are provided, this will use a single sharedtiledb.Ctxinstantiated upon first use. Iftiledb_ctxis provided, that exacttiledb.Ctxis used. If atiledb_configis provided (in the form of adict), it is used to construct a newCtx.- Parameters:
tiledb_ctx – An existing TileDB Context for use as the TileDB Context in this configuration.
tiledb_config – A set of TileDB configuration options to use, overriding the default configuration.
timestamp –
The default timestamp for operations on SOMA objects, provided either as a
datetime.datetimeor a number of milliseconds since the Unix epoch.WARNING: This should not be set unless you are absolutely sure you want to use the same timestamp across multiple operations. If multiple writes to the same object are performed at the same timestamp, they have no defined order. In almost all cases, it is better to pass a timestamp to a single
opencall, or to simply use the default behavior.This is used when a timestamp is not provided to an
openoperation.None, the default, sets the timestamp on each rootopenoperation. That is, if youopena collection, and access individual members of the collection through indexing oradd_new, the timestamp of all of those operations will be that of the time you calledopen.If a value is passed, that timestamp is used as the timestamp to record all operations.
Set to 0xFFFFFFFFFFFFFFFF (UINT64_MAX) to get the absolute latest revision (i.e., including changes that occur “after” the current wall time) as of when each object is opened.
threadpool – A threadpool to use for concurrent operations. If not provided, a new ThreadPoolExecutor will be created with default settings.
Methods
__init__([tiledb_ctx, tiledb_config, ...])Initializes a new SOMATileDBContext.
replace(*[, tiledb_config, tiledb_ctx, ...])Create a copy of the context, merging changes.
Attributes
native_contextThe C++ SOMAContext for this SOMA context.
tiledb_configThe TileDB configuration dictionary for this SOMA context.
tiledb_ctxThe TileDB-Py Context for this SOMA context.
timestampThe default timestamp for SOMA operations, or
Noneif not provided.timestamp_msThe default timestamp for SOMA operations, as milliseconds since the Unix epoch, or
Noneif not provided.threadpoolUser specified threadpool.