Mathias Fußenegger, aka 'Jordi', is one of CrateDB's core engineers and a massive Linux fan. During the recent Snow Sprint, amongst other things, Jordi decided to add a random data generator to his CrateDB dev tools project.
You will need at least Python 3.4, Install with pip.
pip install cr8
Cr8 has five tools available, which can be found by typing cr8 -h
or cr8 <subcommand> -h
. These are summarized below.
Measure the runtime of a specific SQL statement on a cluster:
cr8 timeit "select * from tweets limit 100"SERVER_IP:4200
To generate an insert statement from a supplied JSON string, ready for use on a Crate cluster:
echo '{"name": "Arthur", "lastname": "Dent"}' | cr8 json2insert mytable
Which will generate:
insert into mytable (lastname, name) values (?, ?)
['Dent', 'Arthur']
To upload a file from your local file system to a Crate cluster BLOB table:
cr8 uploadSERVER_IP:4200 blobtable /tmp/screenshot.png
To fill a table with randomly generated data from faker:
cr8 fill-TABLESERVER_IP:4200 mytable 100000
In this example, the 100000
is the amount of records you wish to fill. The script will read the table schema and map these to providers from faker.
For more details on Cr8 - Crate Dev Tools and to keep up to date with the project visit the GitHub repository.