Skip to content

joprice/dynamite

Repository files navigation

Dynamite

Dynamo query REPL

Codacy Badge CircleCI codecov

Installing

brew tap joprice/tap && brew install dynamite

Querying

A limited subset of dynamo and sql are currently supported:

Select

dql> select * from playlists limit 10;

When using a where clause, the table or an appropriate index will be used:

dql> select * from playlists where userId = 1 and id = 2 limit 10;

If there are redundant indexes or for some reason an appropriate one cannnot be found, use use index to provide it explicitly:

dql> select * from playlists where userId = 1 limit 10 use index profileIdIndex;
dql> select id, name from playlists limit 1;

Insert

dql> insert into playlists (userId, id) values (1, 10);

Update

dql> update playlists set name = '80s Party' where userId = 1 and id = 10;

Delete

dql> delete from playlists where userId = 1 and id = 10;

Show tables

dql> show tables;

Describe table

dql> describe table playlists;

DynamoDB Local

By default, Dynamite connects to the DynamoDB instance found via the AWS SDK. To connect to a one-off instance of DynamoDB Local, pass the --load flag:

dynamite --local

Scripting

Dynamite can also be used to run a single script:

dynamite < query.dql

By default, the output is the same as the repl output. This can also be set to 'json' or 'json-pretty':

dynamite --format=json < query.dql

dynamite --format=json-pretty < query.dql

TODO

  • load dynamo client in background on startup
  • order keys before other fields when select *
  • check value type matches when building query key conditions
    • handled in select statements only