All Projects → ldoguin → couchbase-java-importer

ldoguin / couchbase-java-importer

Licence: Apache-2.0 license
This is a pluggable importer for Couchbase

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to couchbase-java-importer

Phpfastcache
A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
Stars: ✭ 2,171 (+16600%)
Mutual labels:  couchdb, couchbase
MiniDao
An powerful enhanced toolkit of SpringJdbc for simplify development
Stars: ✭ 200 (+1438.46%)
Mutual labels:  jdbc
Avancedb
An in-memory database based on the CouchDB REST API and containing the CouchDB Futon and Fauxton web sites
Stars: ✭ 161 (+1138.46%)
Mutual labels:  couchdb
Kivik
Kivik provides a common interface to CouchDB or CouchDB-like databases for Go and GopherJS.
Stars: ✭ 200 (+1438.46%)
Mutual labels:  couchdb
Metadata.js
Library for building offline-first browser-based applications :: платформа автономных веб-приложений
Stars: ✭ 165 (+1169.23%)
Mutual labels:  couchdb
Openag brain
ROS package for controlling an OpenAg food computer
Stars: ✭ 221 (+1600%)
Mutual labels:  couchdb
Nosqlmap
Automated NoSQL database enumeration and web application exploitation tool.
Stars: ✭ 1,928 (+14730.77%)
Mutual labels:  couchdb
NoSQLDataEngineering
NoSQL Data Engineering
Stars: ✭ 25 (+92.31%)
Mutual labels:  couchdb
Rxdb
🔄 A client side, offline-first, reactive database for JavaScript Applications
Stars: ✭ 16,670 (+128130.77%)
Mutual labels:  couchdb
Todo Apps
Sample ToDo application (various languages) running on IBM Cloud
Stars: ✭ 195 (+1400%)
Mutual labels:  couchdb
Couchdb Docker
Semi-official Apache CouchDB Docker images
Stars: ✭ 194 (+1392.31%)
Mutual labels:  couchdb
Firecamp
Serverless Platform for the stateful services
Stars: ✭ 194 (+1392.31%)
Mutual labels:  couchdb
Aquiladb
Drop in solution for Decentralized Neural Information Retrieval. Index latent vectors along with JSON metadata and do efficient k-NN search.
Stars: ✭ 222 (+1607.69%)
Mutual labels:  couchdb
Pifpaf
Python fixtures and daemon managing tools for functional testing
Stars: ✭ 161 (+1138.46%)
Mutual labels:  couchdb
doc
QuickPerf documentation: https://github.com/quick-perf/doc/wiki/QuickPerf
Stars: ✭ 22 (+69.23%)
Mutual labels:  jdbc
Docker Couchdb
🐳 Source of the official Apache CouchDB Docker image ⚠️ NOTICE ⚠️: moved to the CouchDB org
Stars: ✭ 157 (+1107.69%)
Mutual labels:  couchdb
Mycouch
MyCouch is the asynchronous CouchDB client for .NET
Stars: ✭ 211 (+1523.08%)
Mutual labels:  couchdb
AWR.Athena
Short R Wrapper for Athena JDBC connections
Stars: ✭ 23 (+76.92%)
Mutual labels:  jdbc
sublime-simple-import
A Sublime Text Plugin that helps you to import your modules.
Stars: ✭ 15 (+15.38%)
Mutual labels:  importer
Pouchdb
🐨 - PouchDB is a pocket-sized database.
Stars: ✭ 14,625 (+112400%)
Mutual labels:  couchdb

couchbase-java-importer

This is a pluggable importer for Couchbase. So far it supports importing documents from a CSV file, a MongoDB or CouchDB instance.

How to Build

$ ./gradlew build

How to Use

$ cd build/distributions/
$ unzip couchbase-java-importer.zip

At this step you need to choose what kind of import you want to do. Configuration samples are available at the root of the repository.

Let's pretend you want to import a MongoDB collection called restaurants from the database test and add a field called couchbaseType with the value restaurant for every imported documents. Let's also pretend you have a local MongoDB and local Couchbase instance. For that you would need the following configuration

# Hostnames, comma separated list of Couchbase node IP or hostname
hostnames: localhost,127.0.0.1
# Buket name
bucket: default
# Bucket password
password:
# Log to write succesfully imported keys
successLogFilename: succes.out
# Log to write unsuccesfully imported keys
errorLogFilename: error.out
# Default RequestCancelledException delay in milliseconds and maximum number of retries
requestCancelledExceptionDelay: 31000
requestCancelledExceptionRetries: 100
# Default TemporaryFailureException delay in milliseconds and maximum number of retries
temporaryFailureExceptionDelay: 100
temporaryFailureExceptionRetries: 100
# Default upsert timeout in milliseconds
importTimeout: 500
# Choose between CSV, COUCHDB, MONGODB
choosenImporter: MONGODB
mongodb:
  # Give a valid connection string to connect to a MongoDB instance
  connectionString: "mongodb://127.0.0.1:27017/"
  # Name of the MondoDB database to connect to
  dbName: "test"
  # Name of the collection to import
  collectionName: "restaurants"
  # Couchbase does not have collection, we usually use a type field. As there could already be a type field in Mongo, you can specify another fieldName to be used as type
  typeField: "type"
  # type of the documents that will be imported
  type: "restaurant"

This is the content of the MongoDB sample configuration. To run the import copy the configuration file and run the importer:

$ cp ../../../application-mongodb.yml.sample application.yml 
$ ./bin/couchbase-java-importer

Once the import as ran you should have one file called success.out that contains the id of every document imported. If something went wrong you should also have a file called error.out.

Every configuration samples contains comments that should help you understand the various import options.

JDBC Configuration

Start by copying the JDBC sample configuration:

 cp ../../../application-jdbc.yml.sample application.yml 

Make sure you have configured your JDBC connection through the following properties:

spring.jpa.database=POSTGRESQL
spring.datasource.platform=postgres
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.database.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://192.168.99.100:32778/dvdrental
spring.datasource.username=postgres
spring.datasource.password=password

More information available on the spring documentation.

Once you have your connection setup, you can configure what you want to import using the following filters used by the DatabaseMetaData Object.

choosenImporter: JDBC
jdbc:
  catalog: 
  schemaPattern: "public"
  tableNamePattern: 
  types:
  columnNamePattern:

All the selected tables and columns will be stored in a JsonDocument. It's key is defined by the tablesSchemaId property.

jdbc:
  # id of the document containing your database schema to be imported 
  tablesSchemaId: myDatabaseSchema

CouchDB

Start by copying the JDBC sample configuration:

 cp ../../../application-jdbc.yml.sample application.yml 

Then use the downloadURL property to define wich CouchDB documents you want to import. By default it uses the all_docs view with the include_docs flag set to true.

choosenImporter: COUCHDB
couchdb:
  # Download URL 
  downloadURL: http://127.0.0.1:5984/database_export/_all_docs?include_docs=true

CSV

Sample configuration for CSV import:

choosenImporter: CSV
csv:
  # CSV Separating char for rows
  columnSeparator: ';'
  # CSV quotes
  quoteChar: ''
  # Path to the CSV file to import
  csvFilePath: /home/couchbase/csvimporter/advocates.csv
  # Skip the first line of the CSV for field names
  skipFirstLineForNames: true
  # Any format usable by the Java SimpleDateFormat Class
  dateFormat: EEE MMM dd HH:mm:ss z yyyy
  # Language tag used by Java's Locale class
  languageTag: FR_FR
  # Number of columns to import
  totalcolumns: 10
  # Column index to use the column value as id
  keyColumIndex: 0
  # The value of this field will be added as key prefix
  keyPrefix: "advocate::"
  #Give the type of the columns, could be String, Long, Double, Boolean, Date. Must be the exact same size as the number of columns in your file
  columType:
     - STRING
     - STRING
     - STRING
     - STRING
     - STRING
     - DATE
     - LONG
  # Choose the name of the fields for each column, mandatory if skipFirstLineForNames is set to true.
  columName:
     - id
     - type
     - firstname
     - lastname
     - location
     - creationDate
     - count

MongoDB

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].