Code Monkey home page Code Monkey logo

mysql-to-bigquery's Introduction

#Mysql to BigQuery Scripts to synchronize a MySQL data base to a BigQuery data set


#Note on the State of the Code Base

Currently I am not working on this codebase.

I am aware the the docker part of this codebase is not working but with the proper environmental variables it does function.


#Installation


Usage

install.py

Running this script will do the following:

  • Creates GCP storage folder "mysql_sync_keys"
  • Create the following PubSub topics and subscriptions
    • mysql-bq-sync-schema-jobs
    • mysql-bq-sync-data-jobs
    • mysql-bq-sync-audit-jobs
  • Create BigQuery table "data_sources.mysql_sync"

add_service.py

Running this script will walk you through installing a service to be synchronized

CLI Prompts

  • Service Name: the name of the database to be synchronized, this is just a reference name not the host path
  • Data Set: name of the data set as you want it to appear in BigQuery
  • Host: database connection string
  • Username: database username
  • Password: password for the username
  • Database: Database to synchronize

Behind the scenes

  • Stores encrypted credentials in BigQuery "data_sources.mysql_sync" table
  • Generates encryption key and stores that in storage "mysql_sync_keys"

produce.py

Running this script on an interval will produce installed services to the "mysql-bq-sync-schema-jobs" Pubsub topic

Producing a service kicks off the synchronization process

consume.py

Consumers will pull from one of three Pubsub subscriptions based on the configuration of the consumer

PubSub Topics and Consumer Message Flow

Consumers pull of the topics and will do the work as well as move the message to the new topic based on the success of the job.

###Message Flow Messages move from topic to topic according to the following logic

  • Produced from produce.py -> mysql-bq-sync-schema-jobs
  • Messages consumed from mysql-bq-sync-schema-jobs -> mysql-bq-sync-data-jobs
  • Messages consumed from mysql-bq-sync-data-jobs -> mysql-bq-sync-audit-jobs
  • Messages consumed from mysql-bq-sync-audit-jobs and fail their audit -> mysql-bq-sync-schema-jobs

mysql-to-bigquery's People

Contributors

beirving avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.