CLI#
SQLThunder includes a powerful CLI for database interactions without writing Python code.
You can use it to:
Run SELECT queries with or without chunking
Insert data from CSV/Excel files
Execute DDL or DML statements
Overview#
Command |
Description |
Typical Use Case |
|---|---|---|
|
Run SELECT statements (full table, batch, or keyed) |
Exports, dashboards, data previews |
|
Insert rows from file (batch or atomic) |
Ingesting data into SQL from Excel/CSV |
|
Run one non-SELECT SQL command |
Table creation, delete, truncate, alter, etc. |
Use via:
sqlthunder <command> [options]
query — Run a SELECT Query#
Supports standard queries, offset-based chunking (--batch), or key-based pagination (--key_based).
sqlthunder query "SELECT * FROM trades" -c config.yaml
Common options#
Option |
Default |
Description |
|---|---|---|
|
— |
SELECT query string |
|
— |
Path to YAML config |
|
|
Print result to stdout |
|
|
Max rows to print |
|
— |
Save format: |
|
— |
Path to save result file |
Batch mode options (--batch)#
Option |
Default |
Description |
|---|---|---|
|
|
Use offset-based chunking |
|
|
Rows per chunk |
|
|
Max threads for parallel reads (must be less than |
|
|
SQLAlchemy connection pool size. |
|
|
Max overflow connections beyond pool. |
Key-based mode options (--key_based)#
Option |
Default |
Description |
|---|---|---|
|
|
Use key-based pagination |
|
— |
Primary key column name |
|
— |
|
|
— |
Start value for key-based pagination |
|
|
Sort direction |
insert — Insert from CSV or Excel#
sqlthunder insert data.xlsx my_schema.my_table -c config.yaml
Common options#
Option |
Default |
Description |
|---|---|---|
|
— |
Input CSV or Excel file |
|
— |
Target table name (e.g. |
|
— |
Optional conflict handling ( |
|
— |
|
|
— |
Path to write failed rows |
Batch mode options (--batch)#
Option |
Default |
Description |
|---|---|---|
|
|
Use threaded insert |
|
|
Rows per chunk |
|
|
Max threads for parallel inserts (must be less than |
|
|
SQLAlchemy connection pool size. |
|
|
Max overflow connections beyond pool. |
execute — Run a single DDL or DML#
sqlthunder execute "CREATE TABLE users (id INT)" -c config.yaml
Option |
Default |
Description |
|---|---|---|
|
— |
Any SQL statement (non-SELECT) |
|
— |
Path to YAML config |
Global Flags#
Flag |
Description |
|---|---|
|
Enables |
Error Handling#
Invalid combinations of
--outputand--output_pathwill raise CLI errors.For
--key_based,--key_columnand--key_column_typeare required.For
"string"and"date"keys,--start_keyis mandatory.--max_workersis validated againstpool_size + max_overflow.