Skip to main content

Quickstart

This guide outlines the basic usage of the Kwil CLI for configuring a private key, provider, chain ID, and deploying a database. It will also demonstrate how to execute an action and call a view action.

Prerequisites

Make sure that you have downloaded and installed kwil-cli onto your system. Refer to the installation guide for detailed instructions.

Configuration

Persistent Configuration

Configure the Kwil CLI with a persistent global setting using the command below, which will prompt you for the necessary configurations:

kwil-cli configure

Your configuration file will be stored at ~/.kwil-cli/config.json.

Global Flags

For temporary use, you can override persistent configurations by using global flags like so:

kwil-cli --kwil-provider=your.kwil.provider:port --private-key=your_private_key --chain-id=your_chain_id

Global flags take precedence over persistent configs.

Deploying a Database

To deploy a database, you need to have a file containing the database schema in Kuneiform or JSON format:

kwil-cli database deploy --path ./path_to_schema_file

Executing an Action

Execute an action against a database by providing the action name and parameters:

kwil-cli database execute parameter_1:value_1 parameter_2:value_2 --action action_name --dbid target_dbid

Calling a View Action

Call a view (read-only) action on a database using the following command:

kwil-cli database call parameter_1:value_1 --action view_action_name --dbid target_dbid

Note

Remember to replace placeholders such as your.kwil.provider:port, your_private_key, your_chain_id, path_to_schema_file, target_dbid, action_name, parameter:value, and view_action_name with actual values based on your database and setup.

For a more detailed usage of each command, refer to the appropriate section of the Kwil CLI reference guide.