dynamodb-import-csv

1.0.2 • Public • Published

Import csv file into AWS Dynamodb

This module help you to parse your exported dynamodb scv file into json object with data types.

Documentation will improve in future.

How to use

const  csvParse = require('dynamodb-import-csv'); // import npm module

//location of CSV file without beginning slash (/)
const path = 'sample.csv'; 

// parse CSV data into json format
// it will return json format with dynamodb data types
// if records more than 25, json array will split into 25 size chunk arrays

const jsonArray = await csvParse.parseSCVtoJSON(path);

Parsed return object array

{
  "totalItem": 60,
  "chunkSize": 25,
  "chunkCount": 3,
  "data": [
    [
        [object_1],
        [object_2],
        ... 
        [object_25],
    ],
    [
        [object_1],
        [object_2],
        ... 
        [object_25],
    ],
  ]
}

Sample parsed json object with data types

{
    "code": {
        "S": "N8"
    },
    "groups": {
        "L": []
    },
    "message": {
        "S": "sample message"
    },
    "id": {
        "N": 1
    }
}

Readme

Keywords

Package Sidebar

Install

npm i dynamodb-import-csv

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

6.26 kB

Total Files

6

Last publish

Collaborators

  • thiwanka-wickramage