Databases

The commands available for databases are:

$ beat databases --help
Usage: beat databases [OPTIONS] COMMAND [ARGS]...

  Database commands

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  check    Checks a local asset for validity.
  create   Creates a new local asset.
  diff     Shows changes between the local asset and the remote version
  edit     Edit local asset file
  index    Indexes all outputs (of all sets) of a database.
  list     Lists the assets of this type available on the platform.
  path     Displays local path of asset files
  pull     Downloads the specified databases from the server.
  push     Uploads asset to the server
  rm       Deletes a local asset
  status   Shows (editing) status for all available items of asset type
  version  Creates a new version of an existing asset
  view     View the data of the specified dataset.

For instance, a list of the databases available locally can be obtained as follows:

$ beat databases list

A list of the databases available on the remote platform can be obtained by running the following command:

$ beat databases list --remote

Creating a new database

To create a new database locally, create the necessary files (see “Databases” in section “Getting Started with BEAT” in BEAT documentation) and place them on your prefix. Once done, use the following command to index the database:

$ beat database index <db>/1

and if you wan to upload it to the web server issue the following command:

$ beat -p prefix -m <platform> -t <your-token> databases push <db>/1

Replace the string <db> with the fully qualified name of your database. For example, mynewdatabase. Replace <platform> by the address of the BEAT platform you’re trying to interact with. Replace <your-token> by your user token (you can get that information via your settings window on the platform itself).

Note

To create a new version of an existing database, you must use the command-line tool slightly differently, as explained below. The above instructions will not work in this particular case.

Creating a new version of an existing database

To create a new version of database locally, first download the current version and locally create a new version from the current instance. Modify the new version to fit your needs using a text editor of your choice and then upload the new version.

$ beat -p prefix -m <platform> -t <your-token> databases pull <db>/1
...
$ beat -p prefix databases version <db>
...
$ vim prefix/databases/<db>/2.*
# once you're happy, upload the new version
$ beat -p prefix -m <platform> -t <your-token> databases push <db>/2

Replace the string <db> with the name of your database. For example, mynewdatabase. Replace <platform> by the address of the BEAT platform you’re trying to interact with. Replace <your-token> by your user token (you can get that information via your settings window on the platform itself).

Note

At the moment only users with administrative privilege can push databases to the web serve however all users can create and modify databases locally.