Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
- [Formats](command/formats.md)
- [SuperSQL](super-sql/intro.md)
- [Queries](super-sql/queries.md)
- [Statements](super-sql/statements/intro.md)
- [CREATE TABLE](super-sql/statements/create-table.md)
- [CREATE SUPER TABLE](super-sql/statements/create-super-table.md)
- [DROP TABLE](super-sql/statements/drop-table.md)
- [INSERT](super-sql/statements/insert.md)
- [Declarations](super-sql/declarations/intro.md)
- [Constants](super-sql/declarations/constants.md)
- [Types](super-sql/declarations/types.md)
Expand Down Expand Up @@ -212,9 +217,9 @@
- [Data Model](formats/model.md)
- [Super (SUP)](formats/sup.md)
- [Super Binary (BSUP)](formats/bsup.md)
!!- [Database](database/intro.md)
!! - [API](database/api.md)
!! - [Format](database/format.md)
- [Database](database/intro.md)
- [API](database/api.md)
- [Format](database/format.md)
- [Developer](dev/intro.md)
- [Libraries](dev/libraries/intro.md)
- [Go](dev/libraries/go.md)
Expand Down
42 changes: 29 additions & 13 deletions book/src/command/db.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# super db

`super db` is a sub-command of [super](super.md) to manage and query SuperDB databases.

>[!NOTE]
> The database portion of SuperDB is early in development. While previous versions
> have been deployed in production at non-trivial scale, the current version
> is somewhat out of date with recent changes to the runtime. This will be remedied
> in forthcoming releases.
`super db` is a sub-command of [super](super.md) to manage and query SuperDB
[databases](../database/intro.md).

The `super db` command is invoked either by itself to run a query:
```
Expand Down Expand Up @@ -139,6 +134,11 @@ If a table is provided to `from` without a branch name, then branch

Output is sent to a [file or stdout](output.md).

The query text may also be a [script](../super-sql/statements/intro.md)
of statements separated by semicolons, including commands like
[CREATE TABLE](../super-sql/statements/create-table.md) and
[INSERT](../super-sql/statements/insert.md) that modify the database.

If the single argument `-` follows the query, then the lines of standard input
are assembled into a string array called `args` as a
[constant](../super-sql/declarations/constants.md)
Expand Down Expand Up @@ -330,11 +330,12 @@ creates a commit on HEAD replacing the old objects with the new ones.
### super db create

```
super db create [-orderby key[,key...][:asc|:desc]] <name>
super db create [-orderby key[,key...][:asc|:desc]] [-type type] <name>
```
* `-framecap n` target number of values in each BSUP frame of a data object (default 20000)
* `-objectcap n` target number of values in each data object (default 1048576)
* `-orderby key` sort key with optional :asc or :desc suffix to organize data in the table (cannot be changed)
* `-type type` [SUP](../formats/sup.md) type to which all values loaded into the table are cast (cannot be changed)
* `-use` select created table as the current working table (default "false")
* [Global](options.md#global)
* [Database](options.md#database)
Expand All @@ -348,6 +349,17 @@ the data in the table, which may be in ascending or descending order.

If a sort key is not specified, the table is unsorted.

The `-type` option gives the table a type, e.g., `-type '{a:int64,b:string}'`,
to which every value loaded into the table is cast, as with
[CREATE SUPER TABLE](../super-sql/statements/create-super-table.md).
A value that can't be cast fails the load. Without `-type`, a table
holds values of any type.

Tables may also be created with the
[CREATE TABLE](../super-sql/statements/create-table.md) and
[CREATE SUPER TABLE](../super-sql/statements/create-super-table.md)
statements.

The `-objectcap` option sets the target number of values in each of the
table's data objects, which [manage](#super-db-manage) uses when compacting
the table.
Expand Down Expand Up @@ -409,7 +421,8 @@ super db drop [options] <name>|<id>
* [Database](options.md#database)
* [Output](options.md#output)

The `drop` command deletes a table and all of its constituent data.
The `drop` command deletes a table and all of its constituent data,
as does the [DROP TABLE](../super-sql/statements/drop-table.md) statement.

**DANGER ZONE.** You must confirm that you want to delete
the table to proceed. The `-f` option can be used to force the deletion
Expand Down Expand Up @@ -448,10 +461,13 @@ The `load` command commits new data to a branch of a table.

Run `super db load -h` for a list of command-line options.

Note that there is no need to define a schema or insert data into
a "table" as all super-structured data is _self describing_ and can be queried in a
schema-agnostic fashion. Data of any _shape_ can be stored in any table
and arbitrary data _shapes_ can coexist side by side.
Note that there is no need to define a schema before loading data
as all super-structured data is _self describing_ and can be queried in a
schema-agnostic fashion. Data of any _shape_ can be stored in a table
without a type and arbitrary data _shapes_ can coexist side by side.
If the table has a [type](../database/intro.md#tables), each value is
cast to it, and if any value can't be cast, the load fails and nothing
is committed.

As with [super](super.md),
the [input arguments](super.md#options) can be in
Expand Down
Loading
Loading