👤 User Guide

Bucketfs

Depending on the database configuration, the bucketfs setup can range from straight forward to fairly complex. This is due to the fact that:

  • Each database can have one or more BucketFS services (in the On-Prem database)

  • Each BucketFS service is available on all worker cluster of a database

  • Each BucketFS service runs on all data nodes of a database

  • Each BucketFS service can have one or more Buckets (in the On-Prem database)

  • Each Bucket can hold one or more files

The overview bellow tries to illustrate this in a more tangible manner. For more details on bucketfs, please also have a look in the bucketfs section of the database documentation.

BucketFS Overview

Quickstart

"""
These examples are relevant for the On-Prem Exasol database.
"""

from exasol.bucketfs import (
    Service,
    as_bytes,
)

URL = "http://localhost:6666"
CREDENTIALS = {"default": {"username": "w", "password": "write"}}

bucketfs = Service(URL, CREDENTIALS)

# 0. List buckets
buckets = [bucket for bucket in bucketfs]

# 1. Get a bucket
default_bucket = bucketfs["default"]

# 2. List files in bucket
files = [file for file in default_bucket]

# 3. Upload a file to the bucket
default_bucket.upload("MyFile.txt", b"File content")

# 4. Download a file/content
data = as_bytes(default_bucket.download("MyFile.txt"))

# 5. Delete a file from a bucket
default_bucket.delete("MyFile.txt")

Follow Up