Command Line Interface (CLI)

ether_sql has several built in CLI commands to interact with the node and sql table. This section aims at detailing the various cli options available in the library in detail.

We use the Click library to generate CLI groups and their nested commands in a tree structure.

Group: ether_sql

ether_sql

ether_sql is the most basic CLI group with 4 subsequent commands.

ether_sql [OPTIONS] COMMAND [ARGS]...

Options

--settings <settings>

Settings to run ether_sql, choose from DefaultSettings, ParityTestSettings, PersonalGethSettings, PersonalInfuraSettings, PersonalParitySettings, TestSettings [default: DefaultSettings]

Commands

celery

Manages the celery workers (start and stop…

ether

Manages the ether node (query the node).

scrape_block

Pushes the data at block=block_number in the…

scrape_block_range

Pushes the data between start_block_number…

sql

Manages the sql (create/drop/query tables).

SubGroup: ether_sql ether

ether_sql ether

Manages the ether node (query the node).

ether_sql ether [OPTIONS] COMMAND [ARGS]...
blocknumber

Gives the most recent block number in the ether node

ether_sql ether blocknumber [OPTIONS]

SubGroup: ether_sql sql

ether_sql sql

Manages the sql (create/drop/query tables).

ether_sql sql [OPTIONS] COMMAND [ARGS]...
blocknumber

Gives the current highest block in database

ether_sql sql blocknumber [OPTIONS]
create_tables

This is a depreceated function. Alias for ether_sql sql upgrade_tables

ether_sql sql create_tables [OPTIONS]
drop_tables

Alias for ‘alembic downgrade base’. Downgrade to no database tables

ether_sql sql drop_tables [OPTIONS]
export_to_csv

Export the data pushed into sql as csv

ether_sql sql export_to_csv [OPTIONS]

Options

--directory <directory>

Directory where the csv should be exported

--mode <mode>

Choose single is using same thread or parallel if using multiple threads

migrate

Alias for ‘alembic revision –autogenerate’ Run this command after changing sql tables

ether_sql sql migrate [OPTIONS]

Options

-m, --message <message>

Write a message specifying what changed

upgrade_tables

Alias for ‘alembic upgrade head’. Upgrade to latest model version

ether_sql sql upgrade_tables [OPTIONS]

SubGroup: ether_sql celery

ether_sql celery

Manages the celery workers (start and stop celery).

ether_sql celery [OPTIONS] COMMAND [ARGS]...
shutdown

Stops the celery workers

ether_sql celery shutdown [OPTIONS]
start

Starts the celery workers, also allows for passing celery specific arguements.

ether_sql celery start [OPTIONS]

Options

-l, --loglevel <loglevel>

Specifies the log level for the celery workers

-c, --concurrency <concurrency>

Number of parallel workers

Command: ether_sql scrape_block_range

ether_sql scrape_block_range

Pushes the data between start_block_number and end_block_number in the database. If no values are provided, the start_block_number is the last block_number+1 in sql and end_block_number is the current block_number in node. Also checks for missing blocks and adds them to the list of required block numbers

param int start_block_number:
 starting block number of scraping
param int end_block_number:
 end block number of scraping
param str mode:Mode of data sync ‘parallel’ or single
param bool fill_gaps:
 If switched on instructs to also fill missing blocks
ether_sql scrape_block_range [OPTIONS]

Options

--start_block_number <start_block_number>

start block number

--end_block_number <end_block_number>

end block number

--mode <mode>

Choose single is using same thread or parallel if using multiple threads

--fill_gaps, --no-fill_gaps

Command: ether_sql scrape_block

ether_sql scrape_block

Pushes the data at block=block_number in the database

ether_sql scrape_block [OPTIONS]

Options

--block_number <block_number>

block number to add