npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dynamodb-to-mysql

v1.0.6

Published

Export DynamoDB to MySQL

Downloads

374

Readme

DynamoDB to MySQL Transfer Tool

This npm package facilitates the seamless transfer of data from DynamoDB tables to a MySQL server. It offers functionality to explore, scan, and efficiently transfer data while maintaining table structure integrity. By running the tool multiple times, your MySQL database's structure will dynamically update through the usage of ALTER TABLE commands, ensuring data consistency.

Key Features

  • Explore, scan, and transfer DynamoDB tables to MySQL.

  • Automatic updating of MySQL table structure (ALTER TABLE) during data transfer.

  • Ability to specify tables for export, either all tables within a specific region or selected tables.

  • Suitable for production environments, enabling execution of complex queries on MySQL (version 8) databases, simplifying processes compared to using PartiQL or multiple scans.

  • Utilizes parallel scanning capabilities via the @shelf/dynamodb-parallel-scan package.

  • Concurrency settings adjustable through environment variables (refer to documentation for details).

Installation

To install the package, use npm:

npm install dynamodb-to-mysql

Usage

After installation, you can use the tool by importing it into your Node.js application:

// ESModule
import { dynamodb2MySQL, dynamodb2MySQLAllTables } from 'dynamodb-to-mysql';

There are 2 functions; by default, truncate is false. Set true to truncate the MySQL table if it exists.

dynamodb2MySQL(table_name, truncate);
dynamodb2MySQLAllTables(truncate);

Refer to the documentation for detailed usage instructions and examples.

Documentation

You need to set environment variables for MySQL. Default Concurrency for Parallel Scan is 10.

// MacOS or Linux
export MYSQL_HOST=your.mysql.host
export MYSQL_USER=user
export MYSQL_PASSWORD=password
export MYSQL_DATABASE=my_database
export CONCURRENCY=100

You have the option to configure environment variables to customize the MySQL engine and charset. Additionally, verbose mode can be enabled to monitor processes (console.log).

export MYSQL_CHARSET=utf8
export MYSQL_ENGINE=InnoDB
export VERBOSE=true

This package uses the following libraries:

Don't forget to allow access to DynamoDB in IAM

{
	"Version": "2012-10-17",
	"Statement": [
	{
		"Sid": "VisualEditor0",
		"Effect": "Allow",
		"Action": [
			"dynamodb:DescribeTable",
			"dynamodb:Scan"
		],
		"Resource": "*"
	}]
}

See test/test.js for more details

Contributing

Contributions are welcome! Feel free to fork the project.

License

This project is licensed under the GNU General Public License (GPL).


Note: This tool is not affiliated with or endorsed by AWS, MySQL, or any associated organizations.