anystore.model
Models
Pydantic model interfaces to initialize stores and handle metadata for keys.
BaseStats
Bases: BaseModel
Shared base metadata object
Source code in anystore/model.py
created_at = None
class-attribute
instance-attribute
Created at timestamp
raw = {}
class-attribute
instance-attribute
Raw data (to preserve headers)
size
instance-attribute
Size (content length) in bytes
updated_at = None
class-attribute
instance-attribute
Last updated timestamp
Stats
Bases: BaseStats
Meta information for a store key
Source code in anystore/model.py
key
instance-attribute
Full path of key
mimetype
property
Return the mimetype based on response headers or extension
name
instance-attribute
Key name: last part of the key (aka file name without path)
store
instance-attribute
Store base uri
uri
property
Computed uri property. Absolute when file-like prepended with store schema, relative if using different store backend
Returns:
Type | Description |
---|---|
str
|
file-like: |
str
|
relative path for other (redis, sql, ...): |
StoreModel
Bases: BaseModel
Store model to initialize a store from configuration
Source code in anystore/model.py
backend_config = {}
class-attribute
instance-attribute
Backend-specific configuration to pass through for initialization
default_ttl = settings.default_ttl
class-attribute
instance-attribute
Default ttl for keys (only backends that support it: redis, sql, ..)
deserialization_func = None
class-attribute
instance-attribute
Default deserialization function
is_fslike
cached
property
Check if it is a file-like store usable with fsspec
is_http
cached
property
Check if it is a http(s) remote store
is_local
cached
property
Check if it is a local file store
is_s3
cached
property
Check if it is a s3 (compatible) remote store
is_sql
cached
property
Check if it is a sql-like store (sqlite, postgres, ...)
key_prefix = None
class-attribute
instance-attribute
Global key prefix for all keys
model = None
class-attribute
instance-attribute
Default pydantic model for serialization
raise_on_nonexist = settings.raise_on_nonexist
class-attribute
instance-attribute
Raise anystore.exceptions.DoesNotExist
if key doesn't exist
readonly = False
class-attribute
instance-attribute
Consider this store as a read-only store, writing will raise an exception
serialization_func = None
class-attribute
instance-attribute
Default serialization function
serialization_mode = settings.serialization_mode
class-attribute
instance-attribute
Default serialization (auto, raw, pickle, json)
store_none_values = True
class-attribute
instance-attribute
Store None
as value in store
uri
instance-attribute
Store base uri