EdgeSQL Shell is a command-line interface (CLI) tool for interacting with Azion EdgeSQL Database, allowing users to manage databases, execute SQL commands, and perform various database operations.
- List all tables in a database
- Describe table schema
- Dump table structure as SQL
- List all databases
- Switch to a database by name
- Retrieve information about the current database
- Load and execute SQL statements from a file
- Create, destroy, or list databases
- Support for multiline SQL commands
- Transaction support
- Output to standard output or file
- Output on formats Tabular, CSV, JSON, HTML, Markdown, and Raw
- Data Importation:
- Adaptive chunk estimation
- Vector Similarity Search support:
- Datatype (F32_BLOB / FLOAT32)
- Use vector function to convert vector from string representation into the binary format
- From file files: CSV or XLSX capability
- From databases: Mysql or PostgreSQL
- From Kaggle Datasets
- From libSQL from Turso
- Error handling and graceful exit
- Interactive and noninteractive execution
- Python 3.x
- Library Psycopg2
- MySQL Connector/Python
-
Clone this repository:
git clone [email protected]:aziontech/edgesql-shell.git
-
Install the system dependencies:
-
Install the Python dependencies:
python -m venv env source env/bin/activate brew install postgresql pip install -r requirements.txt
-
Set your Azion authentication token as an environment variable:
export AZION_TOKEN="your_auth_token_here"
-
Run the EdgeSQL Shell:
For interactive mode:
python edgesql-shell.py
For noninteractive mode:
python3 edgesql-shell.py -n -c ".use MyDB2024" -c ".tables"
-
Use the commands listed below to interact with the EdgeSQL service:
.tables # List all tables .schema <table_name> # Describe table schema .dump [--schema-only|--data-only] <table_name> # Render database structure as SQL .databases # List all databases .use <database_name> # Switch to a database by name .dbinfo # Get information about the current database .read <file_name> # Load and execute SQL statements from a file .create <database_name> # Create a new database .destroy <database_name> # Destroy a database by name .output stdout|file_path # Set the output to stdout or file .mode tabular|csv|html|markdown|raw # Set output mode .import params table # Import data from file|mysql|postgres|kaggle|turso into TABLE .dbsize # Get the size of the current database in MB .exit # Exit the EdgeSQL Shell
export AZION_BASE_URL="custom.api.azion.com"
export KAGGLE_USERNAME="username"
export KAGGLE_KEY="kaggle_api_key"
export MYSQL_USERNAME="username"
export MYSQL_PASSWORD="password"
export MYSQL_HOST="host_address"
Optional settings:
export MYSQL_PORT=<port>
# For TLS connection
export MYSQL_SSL_CA="ssl_ca"
export MYSQL_SSL_CERT="ssl_cert"
export MYSQL_SSL_KEY="ssl_key"
export MYSQL_SSL_VERIFY_CERT=True|False
export POSTGRES_USERNAME="username"
export POSTGRES_PASSWORD="password"
export POSTGRES_HOST="host_address"
Optional settings:
export POSTGRES_PORT=<port>
# For TLS connection
export POSTGRES_SSL_CA="ssl_ca"
export POSTGRES_SSL_CERT="ssl_cert"
export POSTGRES_SSL_KEY="ssl_key"
export POSTGRES_SSL_VERIFY_CERT=True|False
export TURSO_DATABASE_URL=<https://<db_name>-<organization>.turso.io
export TURSO_AUTH_TOKEN=<token>
Optional settings:
export TURSO_ENCRYPTION_KEY=<encryption_key>
Tips for getting database credentials:
Get the database URL:
turso db show --url <database-name>
Get the database authentication token:
turso db tokens create <database-name>
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.