Database¶
- class dsviper.Database¶
Bases:
objectA Database is a CRUD like transactional database. Use the static factory method create_in_memory(), create(…), open(…), connect(…) or connect_local(…).
Note: Not directly instantiable.
- attachment_getting() AttachmentGetting¶
Return the AttachmentGetting interface.
- begin_transaction(mode: str | None = None) None¶
Begin a transaction where the mode is ‘Deferred’, ‘Immediate’ or ‘Exclusive’.
- blob(blob_id: ValueBlobId) ValueBlob¶
Return a blob or None.
- blob_getting() BlobGetting¶
Return the BlobGetting interface.
- blob_ids() set[ValueBlobId]¶
Return the set of blob_id.
- blob_info(blob_id: ValueBlobId) BlobInfo¶
Return the information for the blob or None.
- blob_infos(blob_ids: set[ValueBlobId]) list[BlobInfo]¶
Return a list of BlobInfo.
- blob_statistics() BlobStatistics¶
Return the statistics for blobs.
- blob_stream_append(blob_stream: BlobStream, blob: ValueBlob) None¶
Append a blob to the stream.
- blob_stream_close(blob_stream: BlobStream) ValueBlobId¶
Return the computed blob_id and close the stream.
- blob_stream_create(blob_layout: BlobLayout, size: int) BlobStream¶
Return a stream to fill a blob.
- close() None¶
Close the database.
- codec_name() str¶
Return the name of the codec.
- commit()¶
Commit the transaction.
- static connect(database: str, host: str, service: str = '54322') Database¶
Connect to a server and use the database.
- static connect_local(database: str, socket_path: str) Database¶
Connect to socket_path and use the database.
- static create(file_path: str, *, documentation: str | None = None) Database¶
Create and return a database.
- create_blob(blob_layout: BlobLayout, blob: ValueBlob) ValueBlobId¶
Create the blob and return the blob_id.
- static databases(host: str, service: str = '54322') list[str]¶
Connect to a server and return the list of databases.
- static databases_local(socket_path: str) list[str]¶
Connect to a server and return the list of databases.
- databasing() Databasing¶
Return the Databasing interface.
- definitions() DefinitionsConst¶
Return the definitions.
- definitions_hexdigest() str¶
Return the hexdigest of the definitions.
- del_blob(blob_id: ValueBlobId) bool¶
Return True if the blob was deleted.
- delete(attachment: Attachment, key: ValueKey) bool¶
Return True if the value was deleted.
- documentation() str¶
Return the documentation.
- extend_definitions(definitions: DefinitionsConst) DefinitionsExtendInfo¶
Extend the definitions.
- get(attachment: Attachment, key: ValueKey) ValueOptional¶
Return and optional<document_type> associated with the key.
- has(attachment: Attachment, key: ValueKey) bool¶
Return True if a document is present for the key.
- in_memory() bool¶
Return True if the database is in memory.
- in_transaction() bool¶
Return True if a transaction is running.
- is_closed() bool¶
Return True if the database is closed.
- static is_compatible(file_path: str) bool¶
Return True if the SQL schema contains required tables.
- keys(attachment: Attachment) ValueSet¶
Return the set of all keys.
- path() str¶
Return the path.
- read_blob(blob_id: ValueBlobId, size: int, offset: int) ValueBlob¶
Return the blob at offset.
- rollback()¶
Roll back the transaction.
- set(attachment: Attachment, key: ValueKey, value: _InputValues) bool¶
Assigns the value to the key.