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

@wavequery/migrator

v0.2.0

Published

Data migration tool from your database to your warehouse

Downloads

20

Readme

WaveQuery Database Migration

WaveQuery Migrator is a powerful and scalable data migration tool designed to simplify the process of moving data from your PostgreSQL/MariaDB/SqlLite database to Google BigQuery. This tool is currently in its prototype phase, with plans for expansion to support additional data sources and destinations in the future.

Features

  • Extract data from PostgreSQL and MySQL/MariaDB databases
  • Transform data to fit BigQuery schema requirements
  • Upload data to Google BigQuery
  • Interactive command-line interface for ease of use
  • Support for OAuth 2.0 and service account authentication with GCP
  • Ability to create BigQuery datasets on-the-fly
  • Option to overwrite or append data in existing BigQuery tables
  • SSH tunneling support for secure remote database connections

Installation

npm install -g @wavequery/migrator

Usage

wavequery fork-data gcp [options]

Options:

  • -h, --host <host>: Database host (required)
  • `-u, --user 1: Database user (required)
  • -p, --password <password>: Database password (required)
  • -d, --database <database>: Database name (required)
  • -P, --port <port>: Database port (default: "5432" for PostgreSQL, "3306" for MySQL/MariaDB)
  • --db-type <type>: Database type (postgres, mysql, or mariadb) (default: "postgres")
  • --project-id <projectId>: GCP Project ID
  • --dataset-id <datasetId>: BigQuery dataset ID
  • --use-key-file: Use service account key file for GCP authentication
  • --key-file <keyFile>: Path to the service account key file
  • --client-id <clientId>: Google OAuth client ID
  • --client-secret <clientSecret>: Google OAuth client secret
  • --redirect-uri <redirectUri>: OAuth redirect URI
  • --overwrite: Overwrite existing tables on your warehouse (default: false)
  • --ssh-tunnel: Use SSH tunnel for database connection
  • --ssh-host <sshHost>: SSH host
  • --ssh-user <sshUser>: SSH user
  • --ssh-password <sshPassword>: SSH password
  • --ssh-private-key <sshPrivateKey>: Path to SSH private key file
  • --keep-files: Keep output files after upload (default: false)

Authentication

WaveQuery supports two methods of authentication with Google Cloud Platform:

  1. OAuth 2.0: The tool will open a browser window for you to authenticate with your Google account.
  2. Service Account: You can use a service account key file for authentication.

Environment Variables

WaveQuery migrator supports the use of environment variables for sensitive information. You can set the following variables in your .env file or in your system's environment:

  • GOOGLE_CLIENT_ID: Your Google OAuth client ID
  • GOOGLE_CLIENT_SECRET: Your Google OAuth client secret
  • REDIRECT_URI: The OAuth redirect URI

Examples

  1. Basic usage with OAuth authentication
@wavequery/migrator fork-data gcp -h localhost -u myuser -p mypassword -d mydatabase
  1. Using a service account key file:
@wavequery/migrator fork-data gcp -h localhost -u myuser -p mypassword -d mydatabase --use-key-file --key-file path/to/keyfile.json
  1. Specifying OAuth credentials via command line:
@wavequery/migrator fork-data gcp -h localhost -u myuser -p mypassword -d mydatabase --client-id your-client-id --client-secret your-client-secret --redirect-url your-redirect-url
  1. Overwriting existing tables that are already on your dataset:
@wavequery/migrator fork-data gcp -h localhost -u myuser -p mypassword -d mydatabase --overwrite
  1. Using SSH tunnel for remote database connection:
@wavequery/migrator fork-data gcp -h remotehost -u dbuser -p dbpassword -d mydb --ssh-tunnel --ssh-host sshhost --ssh-user sshuser --ssh-password sshpass

Troubleshooting

If you encounter any issues while using WaveQuery Migrator, please check the following:

  1. Ensure you have the necessary permissions for both the source database and the destination BigQuery project.
  2. For SSH tunneling, make sure the SSH server allows the authentication method you're using.
  3. Verify that your Google Cloud project has the BigQuery API enabled.
  4. Check that your environment variables are set correctly if you're using them for authentication.

For more detailed error messages, you can run the command with the --verbose flag.

Future Plans

  • Support for additional data sources (MySQL, Oracle, SQL Server, etc.)
  • Support for additional data warehouses (Amazon Redshift, Snowflake, etc.)
  • Advanced data transformation capabilities
  • Scheduled and incremental data migrations
  • Web interface for managing migrations
  • Support for custom plugins and extensions

License

WaveQuery Migrator is released under the MIT License.