csv2dynamo

package module
v0.0.0-...-8271f80 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 10 Imported by: 1

README

csv2dynamo

reimport csv from export function of aws DynamoDB

install

go get github.com/maito1201/csv2dynamo/cmd/csv2dynamo

usage

csv2dynamo [options]
NAME:
   csv2dynamo - reimport csv from export function of aws DynamoDB

USAGE:
   main.exe [global options] command [command options] [arguments...]

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --file value, -f value, --csv value    file to import e.g ./tablename.csv (required)
   --table-name value, -t value           target dynamo db tabe name (required)
   --endpoint value, -e value             endpoint of DynamoDB
   --profile value, -p value              profile of aws cli
   --output value, -o value, --out value  target output (default: stdout), no file will be created if execute option is enabled
   --execute                              is directly execute import command (default: false)
   --help, -h                             show help (default: false)

example

csv2dynamo --table-name sample-table --file ./testdata/sample.csv

read and compile csv
progress: 2/2
complete!
aws dynamodb put-item --table-name sample-table --item {"s_value":{"S":"sample1"},"n_value":{"N":"1"},"bool_value":{"B":true}}
aws dynamodb put-item --table-name sample-table --item {"s_value":{"S":"sample2"},"n_value":{"N":"2"},"bool_value":{"B":false}}

caution

This CLI may not work well with complex table condition(e.g: Table that the data format of the attributes is not unified for each record)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(c *cli.Context) error

Types

type DynamoData

type DynamoData struct {
	Key  string
	Type string
	Val  string
}

func (*DynamoData) ToJsonValue

func (d *DynamoData) ToJsonValue() string

type DynamoInput

type DynamoInput []DynamoData
var (
	Input         []DynamoInput
	InputTemplate DynamoInput
)

func (*DynamoInput) Copy

func (d *DynamoInput) Copy() DynamoInput

func (*DynamoInput) ToJsonString

func (d *DynamoInput) ToJsonString(willExecute bool) string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL