• Stars
    star
    471
  • Rank 92,852 (Top 2 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dump DynamoDB data into a CSV file

AWS DynamoDBtoCSV

Join the chat at https://gitter.im/edasque/DynamoDBtoCSV

This application will export the content of a DynamoDB table into CSV (comma-separated values) output. All you need to do is update config.json with your AWS credentials and region.

The output is comma-separated and each field is enclosed by double quotes ("). Double quotes in the data as escaped as "

This software is governed by the Apache 2.0 license.

Usage

typically, to use you'd run:

node dynamoDBtoCSV.js -t Hourly_ZEDO_Impressions_by_IP > output.csv

or even:

node dynamoDBtoCSV.js -t Hourly_ZEDO_Impressions_by_IP -f output.csv

to export to CSV

Use -d to describe the table prior so you can have an idea of the number of rows you are going to export

node dynamoDBtoCSV.js -t Hourly_ZEDO_Impressions_by_IP -d

to get some information about the table.

Full syntax is:

node dynamoDBtoCSV.js --help
	Usage: dynamoDBtoCSV.js [options]

Options:

  -h, --help                            output usage information
  -V, --version                         output the version number
  -t, --table [tablename]               Add the table you want to output to csv
  -i, --index [indexname]               Add the index you want to output to csv
  -k, --keyExpression [keyExpression]   The name of the partition key to filter results on
  -v, --KeyExpressionValues [value]     The expression for filtering on the primary key
  -S, --select [list of fields]         The list of fields to select on
  -c, --count                           Only get count, requires -pk flag
  -a, --stats [fieldname]               Gets the count of all occurances by a specific field name 
                                        (only string fields are supported presently)
  -e, --endpoint [url]                  Endpoint URL, can be used to dump from local DynamoDB
  -f, --file [file]                     Name of the file to be created
  -d, --describe                        Describe the table
  -p, --profile [profile]               Use profile from your credentials file
  -ec --envcreds                        Load AWS Credentials using AWS Credential Provider Chain

Pre-requisites

You'll need to install a few modules, including:

  • aws-sdk
  • commander
  • dynamodb-marshaler
  • papaparse

npm install

should do it.

Example output

"HashOf10","DateIPAdID","adcount"
"37693cfc748049e45d87b8c7d8b9aacd","2013011720024058205168000000010002","1"
"37693cfc748049e45d87b8c7d8b9aacd","2013011720050084232194000000010002","1"

Advanced queries

Output a selection of columns

node dynamoDBtoCSV.js -t my-table -i rule_type_id_index -k "rule_type_id = :v1" -v "{\":v1\": {\"S\": \"my_primary_key_valye\"}}" -s "rule_type_id, created_by" -r us-west-2

Output stats

node dynamoDBtoCSV.js -t my-table -i rule_type_id_index -k "rule_type_id = :v1" -v "{\":v1\": {\"S\": \"my_primary_key_valye\"}}" -s "rule_type_id, created_by" -r us-west-2 -a created_by

More Repositories

1

cloudwatch2graphite

Bring Amazon AWS Cloudwatch metrics into Graphite
JavaScript
64
star
2

enphaseLocalToInfluxDB

Envoy (NG) solar production & consumption data to InfluxDB and more
Go
14
star
3

dashing-graphite-text-widget

Dashing widget which displays a graphite metric, changes in the last 7 days and a sparkline for the last 30d
CoffeeScript
10
star
4

ec2-manage-snapshots

Manage your AWS EC2 snapshots
PHP
10
star
5

RSSs_Ubersicht_Widget

RSS feeds display widget for Ubersicht, supporting multiple RSS feeds
Go
7
star
6

githubfav2pinboard

export your GitHub favorites as PinBoard bookmarks
JavaScript
4
star
7

docker-nodebb

Repo for auto publishing of my nodebb docker image & its redis companion
3
star
8

Stock-quotes-Widget

รœbersicht Stock quotes Widget
Go
2
star
9

sublime-lebab

This is a Sublime Text plugin for kebab which transpiles your ES5 code to ES2015. It does exactly the opposite of what babel & babel-sublime do
Python
2
star
10

Webcore-Proxy

A small proxy that stands between Webcore and Grafana / Graphite / Statsd / InfluxDB
JavaScript
1
star
11

statsd-front-end-proxy

websocket communications based functional proxy to statsd
JavaScript
1
star
12

move-wordpress-to-docker

Generic mechanism for moving Wordpress sites to Docker
Shell
1
star
13

speedtest-to-statsd

Speedtest stats to statsd
Go
1
star
14

docker-ntopng

Dockerfile
1
star
15

Traefik_PathPrefixStrip_issue_demo

This repo was created to illustrate an issue with Traefik PathPrefixStrip first commented on in this PR: https://github.com/containous/traefik/pull/3631#issuecomment-412660594 and later reported in this issue: https://github.com/containous/traefik/issues/3852.
JavaScript
1
star