Giter Site home page Giter Site logo

couchbase-sql-importer's Introduction

Couchbase SQL Importer

This tool allows you to copy the content of a your tables into Couchbase.

The import

  • Import all rows as JSON document. All table columns are JSON attributes.
  • Optionnaly it is possible to create views, the import tool create 2 types of views:
    • A view all/by_type that allows to query document by type (table)
    • Views for each type (table) to query on Primary Key (type/by_pk)
    • All the views are using the _count reduce function.

If you do not want to build it from source, you can download the JAR here

Usage

  1. Configure an import.properties file with all the parameters

     ## SQL Information ##
     sql.connection=jdbc:mysql://192.168.99.19:3306/world?zeroDateTimeBehavior=convertToNull
     sql.username=root
     sql.password=password
    
     ## Couchbase Information ##
     cb.uris=http://localhost:8091/pools
     cb.bucket=default
     cb.password=
    
     ## Import information
     import.tables=ALL
     import.createViews=true
     import.typefield=type
     import.fieldcase=lower
    
  2. Download the JDBC driver for your database

  3. Run the following command

     java -cp "./CouchbaseSqlImporter.jar:./mysql-connector-java-5.1.25-bin.jar" com.couchbase.util.SqlImporter import.properties
    

Notes

This tool is a small utility that I have developed in few hours as a demonstrator.

I have tested the tool mainly on MySQL with some sample schemas: World (few hundreds of records), Employees (4 millions records); but I have not tried to optimize the import "speed" (for example multithreading, divide select is chunks, ...).

I addition to the tests that I need to do with multiple databases types, I also need to create a test suite.

To do

  • Implement a test suite
  • Provide "Report/Logging"
  • Create Document keys using PK columns
    • Error/Log for long keys (>250char)
  • Test multiple databases, at least Oracle

couchbase-sql-importer's People

Contributors

tgrall avatar volkan 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.