How to use EdgeSQL Shell commands
EdgeSQL Shell provides a command-line interface to manage and interact with your Edge SQL databases. Beyond executing SQL queries, it offers a comprehensive set of commands for database administration and configuration.
This guide covers the available commands for interacting with the EdgeSQL service and managing environment variables.
EdgeSQL Shell commands
help
Shows information about the available commands or a specific command.
Example:
.databases
Lists all databases.
.use
Switches to a specific database.
.tables
Lists all tables in the database.
.schema
Describes the schema of a specific table.
.dbinfo
Retrieves information about the current database.
.read
Loads and executes SQL queries from a file.
.create
Creates a new database.
.destroy
Destroys a specific database.
.output
Sets the output destination. Pass stdout
as parameter to output to the console or inform a file path to define it as the output destination.
Example using a file as destination:
.dump
Renders the table structure as SQL. After running the output
command and setting the output to a file, the dump
command will save the output to the selected file.
You can pass the options --schema-only
or --data-only
to optionally render only the schema or the data of the table.
Example:
.mode
Sets the output mode. You can choose one of the following options:
- excel
- tabular
- csv
- json
- html
- markdown
- raw
Example:
.import
Imports data from an external source into the table. You can import data from a file or from a MySQL, Postgres, Kaggle or Turso database.
By running the help
command you can get a list of the possible parameters for importing data:
You will receive a response similar to this:
.dbsize
Gets the size of the current database in MB.
.exit
Exits the EdgeSQL Shell.
Environment variables
When using the EdgeSQL Shell to import data from external sources, you can send the credentials and tokens as environment variables byt using the export
command. This command is also used for setting your Azion personal token.
Personal token
You can send your personal token as an environment variable in EdgeSQL Shell.
Kaggle credentials
Use the following commands to set your Kaggle credentials:
MySQL credentials
Use the following commands to set your MySQL credentials:
Optional settings for MySQL:
PostgreSQL credentials
Use the following commands to set your PostgreSQL credentials:
Optional settings for PostgreSQL:
Turso credentials
Use the following commands to set your Turso credentials:
Optional settings for Turso:
Go to EdgeSQL Shell installation guide