Bucket Management¶
Creating Buckets¶
ArcaneDB provides three distinct creation modes, controlled by keyword modifiers on the create bucket statement. The schema is declared as a parenthesised, comma-separated list of field_name: type pairs.
Syntax:
create [forced] [unique] bucket <name> (<field>: <type>, ...);
create [forced] [unique] bucket <name> from csv("<filepath>");
Creation Modes:
Syntax |
Behaviour |
|---|---|
|
Attempts to create the bucket. Raises an error if a bucket with that name already exists. |
|
Creates the bucket only if it does not already exist. If it exists, the statement is silently ignored. Equivalent to SQL’s |
|
Always creates the bucket, dropping and replacing any existing bucket of the same name along with all its data. |
|
If the bucket exists, it is dropped and recreated (identical to |
Example — schema declaration:
create forced bucket Sales (
product: string,
price: float,
quantity: int,
revenue: float,
timestamp: int
);
Example — creation from a CSV file:
create forced unique bucket Products2 from csv("generated.csv");
When creating from a CSV file, ArcaneDB infers the schema from the file’s header row and populates the bucket with the file’s data in a single operation.
Dropping a Field¶
An individual field can be permanently removed from a bucket’s schema using the drop statement. The field is removed from all existing records as well as from the schema definition. This operation is irreversible without recreating the bucket.
Syntax:
drop <field> from <bucket>;
Example:
drop price from Products;
After execution, the price field no longer exists on any record in Products and cannot be referenced in subsequent queries against that bucket.
Truncating a Bucket¶
The truncate statement removes all records from a bucket while preserving the schema.
Syntax:
truncate <bucket>;
Example:
truncate Names;
Inspecting a Bucket¶
The describe statement prints the schema of a named bucket, including all field names and their types.
Syntax:
describe <bucket>;
Example:
describe Products;
describe Names;
Listing All Buckets¶
The show buckets statement enumerates all buckets currently registered in the database.
Syntax:
show buckets;