gufo.blob.sync.sqlite¶
SQLiteBlob implementation.
SQLiteBlob
¶
Bases: BlobBase
Sync SQLite backend for Gufo Blob.
URL format
sqlite:///path/to/db.sqlite
connection
property
¶
Get SQLite connection.
Connect and initialize database schema when necessary.
key_col
property
¶
Get key column name.
path
property
¶
Get database path.
table
property
¶
Get table name.
value_col
property
¶
Get value column name.
clean_db_item(name)
staticmethod
¶
Check database field or table name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
database object name. |
required |
Returns:
| Type | Description |
|---|---|
str
|
database object name if valid. |
Raises:
| Type | Description |
|---|---|
BlobError
|
on invalid name |
close()
¶
Close connection.
delete(key)
¶
Delete key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Object key. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the key does not exist. |
BlobError
|
On backend or I/O failure. |
exists(key)
¶
Check whether a key exists in the blob store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Object key. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the key exists, False otherwise. |
Raises:
| Type | Description |
|---|---|
BlobError
|
On backend or I/O failure. |
get(key)
¶
Retrieve data by key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Object key. |
required |
Raises:
| Type | Description |
|---|---|
BlobError
|
On backend or I/O failure. |
iter_init_sql()
¶
Iterate database initialization queries.
open()
¶
Explicitly open connection.
parse_url(url)
classmethod
¶
Parse URL and extract parameters for constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL to parse. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
|