https://github.com/aziontech/edgesql-shell
A command-line interface for interacting with Azion's EdgeSQL service.
https://github.com/aziontech/edgesql-shell
azion cli edge-computing edgesql sql sqlite
Last synced: 3 months ago
JSON representation
A command-line interface for interacting with Azion's EdgeSQL service.
- Host: GitHub
- URL: https://github.com/aziontech/edgesql-shell
- Owner: aziontech
- License: mit
- Created: 2024-03-17T09:04:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-10-20T09:35:38.000Z (4 months ago)
- Last Synced: 2025-10-24T13:58:05.745Z (3 months ago)
- Topics: azion, cli, edge-computing, edgesql, sql, sqlite
- Language: Python
- Homepage: https://www.azion.com
- Size: 1.64 MB
- Stars: 4
- Watchers: 12
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# EdgeSQL Shell
[](https://www.python.org)

EdgeSQL Shell is a command-line interface (CLI) tool for interacting with Azion EdgeSQL Database, allowing users to manage databases, Execute SQL commands on Azion EdgeSQL databases.
## EdgeSQL Shell Documentation Index
- [EdgeSQL Shell](#edgesql-shell)
- [EdgeSQL Shell Documentation Index](#edgesql-shell-documentation-index)
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Other Settings](#other-settings)
- [Setting Custom Azion API Entrypoint](#setting-custom-azion-api-entrypoint)
- [Setting Kaggle Credentials](#setting-kaggle-credentials)
- [Setting MySQL Credentials](#setting-mysql-credentials)
- [Setting SQLite Usage](#setting-sqlite-usage)
- [Setting PostgreSQL Credentials](#setting-postgresql-credentials)
- [Setting Turso Credentials](#setting-turso-credentials)
- [Contributing](#contributing)
- [License](#license)
## Features
- 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, PostgreSQL or SQLite
- From Kaggle Datasets
- From libSQL from Turso
- Error handling and graceful exit
- Interactive and noninteractive execution
## Requirements
- Python 3.x
- Library Psycopg2
- MySQL Connector/Python
## Installation
1. Clone this repository:
```bash
git clone git@github.com:aziontech/edgesql-shell.git
```
2. Install the system dependencies:
- [mysql-connector-python](https://pypi.org/project/mysql-connector-python/)
- [psycopg2](https://pypi.org/project/psycopg2/)
3. Install the Python dependencies:
```bash
python -m venv env
source env/bin/activate
brew install postgresql
pip install -r requirements.txt
```
## Usage
1. Set your Azion authentication token as an environment variable:
```bash
export AZION_TOKEN="your_auth_token_here"
```
2. Run the EdgeSQL Shell:
For interactive mode:
```bash
python edgesql-shell.py
```
For noninteractive mode:
```bash
python3 edgesql-shell.py -n -c ".use MyDB2024" -c ".tables"
```
4. Use the commands listed below to interact with the EdgeSQL service:
```bash
.tables # List all tables
.schema # Describe table schema
.dump [--schema-only|--data-only] # Render database structure as SQL
.databases # List all databases
.use # Switch to a database by name
.dbinfo # Get information about the current database
.read # Load and execute SQL statements from a file
.create # Create a new database
.destroy # 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
```
## Other Settings
### Setting Custom Azion API Entrypoint ###
```bash
export AZION_BASE_URL="custom.api.azion.com"
```
### Setting Kaggle Credentials ###
```bash
export KAGGLE_USERNAME="username"
export KAGGLE_KEY="kaggle_api_key"
```
### Setting MySQL Credentials ###
```bash
export MYSQL_USERNAME="username"
export MYSQL_PASSWORD="password"
export MYSQL_HOST="host_address"
```
Optional settings:
```bash
export MYSQL_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
```
### Setting SQLite Usage ###
SQLite databases are file-based and do not require credentials like other databases. To use an SQLite database, specify the path to the `.db` file in your import commands.
Example:
```bash
.import sqlite /path/to/your/database.db source_table_name target_table_name
```
### Setting PostgreSQL Credentials ###
```bash
export POSTGRES_USERNAME="username"
export POSTGRES_PASSWORD="password"
export POSTGRES_HOST="host_address"
```
Optional settings:
```bash
export POSTGRES_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
```
### Setting Turso Credentials ###
```bash
export TURSO_DATABASE_URL=-.turso.io
export TURSO_AUTH_TOKEN=
```
Optional settings:
```bash
export TURSO_ENCRYPTION_KEY=
```
Tips for getting database credentials:
Get the database URL:
```bash
turso db show --url
```
Get the database authentication token:
```bash
turso db tokens create
```
## Contributing
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.
## License
This project is licensed under the MIT License.