0.5.2 • Published 2 months ago

@suna66/ddbpartiql-wrap v0.5.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

ddbql - dynamodb partiql cli tool

Overview

PartiQL front-end wrapper tool for DynamoDB

Install

$ npm install -g @suna66/ddbpartiql-wrap

Build & Install

$ npm i
$ npm run build
$ npm install -g .

Command

ddbql [OPTIONS] [scritp file]

OPTIONS:
    -h/--help                   printing how to use
    -p/--profile {profile}      aws profile name
    -r/--region  {region}       aws region name
    -v/--verbose                verbose mode
    -E/--endpoint {url}         endpoint url
    -F/--format {json/table}    query response format(default: json)
    --access_key {value}        aws credential access key id
    --secret_access_key {value} aws credential secret access key
    --nostop                    not stop script when error is occurred

Example

Insert

ddbql> insert into "ddb-test-table" value {'id': 10, 'name': 'name1','age': 20};

Select

ddbql> select * from "ddb-test-table";

You can also use the LIMIT clause.

ddbql> select * from "ddb-test-table" limit 5;

Select for INDEX

ddbql> select * from "ddb-test-table"."ddb-test-index" where name='name1';

Update

ddbql> update "ddb-test-table"
  set age = 25 
  set address="hogehoge"
  where id=10 and name='name1';

Delete

ddbql> delete from "ddb-test-table" where id=10 and name='name1';

Show Tables(extension query)

ddbql> show tables;

Describe Table(extension query)

ddbql> desc "ddb-test-table";

Create Table(extension query)

ddbql> create table "test-table"(id N HASH, age N RANGE, index global "index-global"(age N HASH));

Truncate Table(extension query)

ddbpq> truncate table "test-table";

Drop Table(extension query)

ddbql> drop table "test-table";

Clear prompt

ddbql> clear

Exit partiql prompt

ddbql> exit

Simple variable system

ddbql> @variable = ddb-test-table;
ddbql> select * from "${variable}"

build-in variables

  • UUID : Generating UUID.
  • NOW : Current UNIX epoch time(Second).

build-in functions

  • sleep {integer} : sleep thread(ms)
  • clear : clear console
  • exit : exit prompt
  • connect : re-connect dynamodb
    [OPTIOIN]
    -p/--profile {profile}      aws profile name
    -r/--region  {region}       aws region name
    -E/--endpoint {url}         endpoint url
    --access_key {value}        aws credential access key id
    --secret_access_key {value} aws credential secret access key
  • . {script file} : load script file

Other Commands

  • !? show command list
  • !h show execute query history
  • !v show variables and values
  • !! re-run previouse query(if previous query returned NextToken, retrying query will add the NextToken)

Copyright and Disclaimer

This software is free software. Please feel free to use it. The copyright is held by the author, "suna66".

Neither I, anyone related to me, nor any of the organizations or groups I belong to, will be held responsible for any damages, losses, or other inconveniences that may arise from the use of this software. Use at your own risk.

0.5.0

4 months ago

0.4.0

4 months ago

0.5.2

2 months ago

0.5.1

3 months ago

0.3.2

4 months ago