database
Classes:
-
DatabaseStorage–Stores data directly in the database instead of remotely.
Attributes:
-
database_storage–A singleton instance of DatabaseStorage for convenience.
database_storage
module-attribute
database_storage = DatabaseStorage()
A singleton instance of DatabaseStorage for convenience.
DatabaseStorage
Stores data directly in the database instead of remotely.
Is constrained to:
- JSON content types (e.g.,
application/json,application/vnd.api+json) - No data streams, only single JSON strings
- A maximum size. By default it warns at 10 KB and raises an error at 100 KB.
Is most useful in cases where
Methods:
-
deserialize_config–Return the data as-is because it is already a JSON string.
-
read_data–Load data using the given information.
-
read_data_stream–Load a stream of data using the given information.
-
serialize_config–Return the config as-is because it is already a JSON string.
-
write_data–Save the given value data.
-
write_data_stream–Save the given data stream.
deserialize_config
Return the data as-is because it is already a JSON string.
read_data_stream
read_data_stream(config: str) -> AsyncGenerator[bytes]
Load a stream of data using the given information.
serialize_config
Return the config as-is because it is already a JSON string.
write_data
async
Save the given value data.