SqlKeyValueStoreClient
Hierarchy
- SqlClientMixin
- KeyValueStoreClient
- SqlKeyValueStoreClient
Index
Methods
__init__
Initialize a new instance.
Preferably use the
SqlKeyValueStoreClient.openclass method to create a new instance.Parameters
keyword-onlystorage_client: SqlStorageClient
keyword-onlyid: str
Returns None
delete_value
Delete a value from the key-value store by its key.
The backend method for the
KeyValueStore.delete_valuecall.Parameters
keyword-onlykey: str
Returns None
drop
Delete this key-value store and all its records from the database.
This operation is irreversible. Uses CASCADE deletion to remove all related records.
Returns None
get_metadata
Get the metadata of the key-value store.
Returns KeyValueStoreMetadata
get_public_url
Get the public URL for the given key.
The backend method for the
KeyValueStore.get_public_urlcall.Parameters
keyword-onlykey: str
Returns str
SQL implementation of the key-value store client.
This client persists key-value data to a SQL database with transaction support and concurrent access safety. Keys are mapped to rows in database tables with proper indexing for efficient retrieval.
The key-value store data is stored in SQL database tables following the pattern:
key_value_storestable: Contains store metadata (id, name, timestamps)key_value_store_recordstable: Contains individual key-value pairs with binary value storage, content type, and size informationkey_value_store_metadata_buffertable: Buffers metadata updates for performance optimizationValues are serialized based on their type: JSON objects are stored as formatted JSON, text values as UTF-8 encoded strings, and binary data as-is in the
LargeBinarycolumn. The implementation automatically handles content type detection and maintains metadata about each record including size and MIME type information.All database operations are wrapped in transactions with proper error handling and rollback mechanisms. The client supports atomic upsert operations and handles race conditions when multiple clients access the same store using composite primary keys (key_value_store_id, key).