|
| 1 | +--- |
| 2 | +name: exasol-bucketfs |
| 3 | +description: "Exasol BucketFS file system management via exapump CLI. Covers listing, uploading, downloading, and deleting files and directories in BucketFS, BucketFS configuration, bucket structure, and use with UDFs." |
| 4 | +--- |
| 5 | + |
| 6 | +# Exasol BucketFS Skill |
| 7 | + |
| 8 | +Trigger when the user mentions **BucketFS**, **exapump**, **bucket**, **bfsdefault**, **upload to BucketFS**, **download from BucketFS**, **delete from BucketFS**, **BucketFS path**, **BucketFS file**, or any BucketFS file management task. |
| 9 | + |
| 10 | +## BucketFS Concepts |
| 11 | + |
| 12 | +**BucketFS** is a synchronous distributed file system available on all nodes of an Exasol cluster. Files stored in BucketFS are automatically replicated to every cluster node. |
| 13 | + |
| 14 | +Key concepts: |
| 15 | +- **Service**: A named BucketFS instance. The default service is `bfsdefault`. |
| 16 | +- **Bucket**: A storage container within a service. The default bucket is `default`. |
| 17 | +- **Path inside BucketFS**: Files are referenced by the path within the bucket (e.g., `models/my_model.pkl`). |
| 18 | +- **Local path inside UDFs**: Files are accessible at `/buckets/<service>/<bucket>/<path>` (e.g., `/buckets/bfsdefault/default/models/my_model.pkl`). |
| 19 | + |
| 20 | +Important characteristics: |
| 21 | +- Writes are atomic — a file is either fully written or not at all. |
| 22 | +- No transactions and no file locks; the latest write wins. |
| 23 | +- All nodes see identical content after synchronisation. |
| 24 | +- BucketFS is not included in database backups — manage backups separately. |
| 25 | +- Not suited for very large datasets due to replication overhead. |
| 26 | + |
| 27 | +## exapump CLI |
| 28 | + |
| 29 | +The `exapump` command is the CLI tool for managing BucketFS. All BucketFS operations use the `exapump bucketfs` subcommand. |
| 30 | + |
| 31 | +### Connection Configuration |
| 32 | + |
| 33 | +Connection settings are stored in `~/.exapump/config.toml` as named profiles. Example: |
| 34 | + |
| 35 | +```toml |
| 36 | +[production] |
| 37 | +host = "exasol-prod.example.com" |
| 38 | +user = "admin" |
| 39 | +password = "s3cret" |
| 40 | +default = true |
| 41 | +bfs_write_password = "bucketpw" |
| 42 | +bfs_read_password = "bucketpw" |
| 43 | +``` |
| 44 | + |
| 45 | +Key profile fields: |
| 46 | + |
| 47 | +| Field | Default | Purpose | |
| 48 | +|-------|---------|---------| |
| 49 | +| `bfs_host` | Falls back to `host` | BucketFS hostname | |
| 50 | +| `bfs_port` | `2581` | BucketFS port | |
| 51 | +| `bfs_bucket` | `default` | Bucket name | |
| 52 | +| `bfs_write_password` | Required | Write authentication | |
| 53 | +| `bfs_read_password` | Falls back to write password | Read authentication | |
| 54 | +| `bfs_tls` | Falls back to `tls` | Enable TLS | |
| 55 | +| `bfs_validate_certificate` | Falls back to `validate_certificate` | Certificate validation | |
| 56 | + |
| 57 | +Connection parameters can also be overridden per command via CLI flags (highest priority): |
| 58 | + |
| 59 | +| Flag | Purpose | |
| 60 | +|------|---------| |
| 61 | +| `--profile` | Select a named profile | |
| 62 | +| `--bfs-host` | Override hostname | |
| 63 | +| `--bfs-port` | Override port | |
| 64 | +| `--bfs-bucket` | Override bucket name | |
| 65 | +| `--bfs-write-password` | Override write password | |
| 66 | +| `--bfs-read-password` | Override read password | |
| 67 | +| `--bfs-tls` | Override TLS setting | |
| 68 | +| `--bfs-validate-certificate` | Override certificate validation | |
| 69 | + |
| 70 | +**Parameter resolution order:** CLI flags → profile values → smart defaults. |
| 71 | + |
| 72 | +### Configuration Protocol |
| 73 | + |
| 74 | +**Before any BucketFS operation**, verify the connection is configured: |
| 75 | + |
| 76 | +1. Check if `~/.exapump/config.toml` exists and contains a default profile. |
| 77 | +2. If configured, proceed with the operation. |
| 78 | +3. If not configured, **ask the user** for the required connection details (host, port, bucket, passwords). Do not guess or assume any defaults. Help the user create the profile in `~/.exapump/config.toml`. |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Commands |
| 83 | + |
| 84 | +### `ls` — List Contents |
| 85 | + |
| 86 | +```bash |
| 87 | +exapump bucketfs ls [PATH] [OPTIONS] |
| 88 | +exapump bucketfs ls -r [PATH] # Recursive listing |
| 89 | +exapump bucketfs ls --recursive [PATH] |
| 90 | +``` |
| 91 | + |
| 92 | +**Examples:** |
| 93 | +```bash |
| 94 | +exapump bucketfs ls # List bucket root |
| 95 | +exapump bucketfs ls models/ # List a directory |
| 96 | +exapump bucketfs ls -r models/ # Recursively list all files under models/ |
| 97 | +``` |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +### `cp` — Copy / Upload / Download |
| 102 | + |
| 103 | +Direction is automatically determined by the source type (local file vs. BucketFS path). |
| 104 | + |
| 105 | +Upload a local file to BucketFS: |
| 106 | +```bash |
| 107 | +exapump bucketfs cp <local-file> <bucket-path> |
| 108 | +exapump bucketfs cp <local-file> <bucket-dir>/ # Preserve filename |
| 109 | +``` |
| 110 | + |
| 111 | +Download a file from BucketFS to local: |
| 112 | +```bash |
| 113 | +exapump bucketfs cp <bucket-path> <local-path> |
| 114 | +``` |
| 115 | + |
| 116 | +**Examples:** |
| 117 | +```bash |
| 118 | +exapump bucketfs cp my_model.pkl models/my_model.pkl # Upload with explicit name |
| 119 | +exapump bucketfs cp my_model.pkl models/ # Upload, preserve filename |
| 120 | +exapump bucketfs cp library.jar jars/library.jar # Upload JAR for UDF |
| 121 | +exapump bucketfs cp models/my_model.pkl . # Download to current dir |
| 122 | +exapump bucketfs cp models/my_model.pkl ./local-copy.pkl # Download with rename |
| 123 | +``` |
| 124 | + |
| 125 | +--- |
| 126 | + |
| 127 | +### `rm` — Remove a File |
| 128 | + |
| 129 | +```bash |
| 130 | +exapump bucketfs rm <path-in-bucket> |
| 131 | +``` |
| 132 | + |
| 133 | +**Examples:** |
| 134 | +```bash |
| 135 | +exapump bucketfs rm models/old_model.pkl # Delete a single file |
| 136 | +``` |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## Typical Use Cases |
| 141 | + |
| 142 | +### Upload a JAR for a Java UDF |
| 143 | + |
| 144 | +```bash |
| 145 | +exapump bucketfs cp my_library.jar jars/my_library.jar |
| 146 | +``` |
| 147 | + |
| 148 | +Reference in UDF SQL: |
| 149 | +```sql |
| 150 | +CREATE OR REPLACE JAVA SCALAR SCRIPT my_schema.my_func(input VARCHAR(2000)) |
| 151 | +RETURNS VARCHAR(2000) AS |
| 152 | + %scriptclass com.example.MyClass; |
| 153 | + %jar /buckets/bfsdefault/default/jars/my_library.jar; |
| 154 | +/ |
| 155 | +``` |
| 156 | + |
| 157 | +### Upload an ML Model for a Python UDF |
| 158 | + |
| 159 | +```bash |
| 160 | +exapump bucketfs cp model.pkl models/model.pkl |
| 161 | +``` |
| 162 | + |
| 163 | +Load in Python UDF: |
| 164 | +```python |
| 165 | +import pickle |
| 166 | +with open('/buckets/bfsdefault/default/models/model.pkl', 'rb') as f: |
| 167 | + model = pickle.load(f) |
| 168 | +``` |
| 169 | + |
| 170 | +### Upload a Custom Script Language Container (SLC) |
| 171 | + |
| 172 | +```bash |
| 173 | +exapump bucketfs cp my_slc.tar.gz slc/my_slc.tar.gz |
| 174 | +``` |
| 175 | + |
| 176 | +Then activate via SQL: |
| 177 | +```sql |
| 178 | +ALTER SESSION SET SCRIPT_LANGUAGES='PYTHON3=localzmq+protobuf:///bfsdefault/default/slc/my_slc?lang=python#buckets/bfsdefault/default/slc/my_slc/exaudf/exaudfclient_py3'; |
| 179 | +``` |
| 180 | + |
| 181 | +### Browse and Clean Up BucketFS |
| 182 | + |
| 183 | +```bash |
| 184 | +exapump bucketfs ls -r # See all files |
| 185 | +exapump bucketfs rm old_model.pkl # Remove an outdated file |
| 186 | +``` |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +## Related Skills |
| 191 | + |
| 192 | +- **exasol-udfs**: For creating UDF scripts that reference files stored in BucketFS. |
| 193 | +- **exasol-database**: For SQL-level operations and connecting to Exasol. |
0 commit comments