Blob
Interface for Datatailr's binary large object (blob) storage.
Blob storage allows you to persist and retrieve arbitrary files and binary data. Each blob is identified by a unique name (key).
Example
from datatailr import Blob
blob = Blob()
blob.put_blob("greeting", b"Hello, world!")
data = blob.get_blob("greeting")
delete(name)
Delete a blob.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the blob to delete. |
required |
exists(name)
Check if a blob exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the blob to check. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the blob exists, False otherwise. |
get_blob(name)
Get a blob object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the blob to retrieve. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Blob |
bytes
|
The blob object. |
get_file(name, path)
Copy a blob file to a local file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the blob to retrieve. |
required |
path
|
str
|
The path to store the blob as a file. |
required |
ls(path)
List files in the specified path.
:param path: The path to list files from. :return: A list of file names in the specified path.
put_blob(name, blob)
Put a blob object into the blob storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the blob to create. |
required |
blob
|
bytes | str
|
The blob object to store. |
required |
put_file(name, path)
Copy a local file to a blob.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the blob to create. |
required |
path
|
str
|
The path of the local file to copy. |
required |