transfer-db: ODBC database transfer

[ bsd3, database, library, program ] [ Propose Tags ]

Simple ODBC application that transfers data between 2 databases. It is based on sqlcli package that should be installed with the odbc flag set. To build the application, you need odbc libraries installed. On Windows, they are installed by default. On unix, you should use unixODBC package.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.3.1.0, 0.3.1.1, 0.3.1.2
Change log ChangeLog
Dependencies aeson (>=1.0), base (>=4.7 && <5), bytestring (>=0.10.8 && <0.11), cassava (>=0.5.0.0 && <0.6), clock (>=0.7 && <0.8), console-program (>=0.4.2.2 && <0.5), containers (>=0.5 && <0.6), logging (>=3.0 && <4), monad-control (>=0.3.2.3), sqlcli (>=0.2 && <0.3), sqlcli-odbc (>=0.2 && <0.3), stm (>=2.4 && <2.5), store (>=0.4.3 && <0.5), store-core (>=0.4.1 && <0.5), temporary (>=1.1 && <1.3), text (>=0.11.3.1), th-utilities (>=0.2.0.1 && <0.3), time (>=1.8 && <1.9), transfer-db, transformers (>=0.5 && <0.6), yaml (>=0.8.22 && <0.9) [details]
License BSD-3-Clause
Copyright 2017 Mihai Giurgeanu
Author Mihai Giurgeanu
Maintainer mihai.giurgeanu@gmail.com
Category Database
Home page http://hub.darcs.net/mihaigiurgeanu/transfer-db
Uploaded by mihaigiurgeanu at 2018-03-17T22:37:13Z
Distributions
Executables transfer-db
Downloads 1680 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-03-18 [all 1 reports]

Readme for transfer-db-0.3.1.2

[back to package description]

transfer-db

Simple ODBC application that transfers data between 2 databases.

The application uses the SQL/CLI API and only few ODBC extensions that are absolutely needed to make ODBC work. This means that the application is easily portable to other SQL/CLI implementations.

It includes a database agnostic dump file format library.

Current release is 0.3.1.1.

Release Notes

The dump and restore are not finalized yet, so they don't work with the current version.

SYNOPSYS

To use transfer-db you either right your own transfer plan by hand or use transfer-db to generate a transfer plan for you. You can edit the generated tranfer plan.

A transfer plan is an yaml file specifying the database connection parameters and what tables and data should be transferred.

Gnereating a plan:

transfer-db makePlan splitByRows <n> -d<SOURCEDB_ODBC_DATASOURCE> -u<SOURCEDB_USER_NAME> -p<SOURCEDB_PASSWORD> -s<SOURCEDB_SCHEMA> -D<DESTDB_ODBC_DATASOURCE> -U<DESTDB_USER_NAME> -P<DESTDB_PASSWORD> -S<DESTDB_SCHEMA> > my-plan.yaml

This command will generate on the standard output a plan for transferring the database SOURCEDB DESTDB in batches of <n> rows (the splitByRows sub-command). In case of failure, you could restart the process by skipping the completed batches.

After that, simply run:

transfer-db run my-plan.yaml > therun-0001.log

This command will run the plan in the my-plan.yaml file and will capture the stdout of transfer-db command into the file therun-0001.log. This file logs the transferred tables and batches and could be used to generate a corrective plan in case something went wrong. On console (stderr) there will be printed detailed information about running the plan.

For more advanced options, on controlling the number of threads or of what batches should be run, type:

transfer-db help

To generate a corrective plan, you need the original plan and the stdout log generated by the run command:

transfer-db correctivePlan my-plan.yaml -sfix-001.sql -pnew-plan.yaml -itherun-001.log

This command will read the original plan from my-plan.yaml file, the log of the previous run from therun-001.log file and will generate 2 files:

  • fix-001.sql that you will need to run to against the destination database in order to remove partial batches.
  • new-plan.yaml that you should use with for a new transfer run, to transfer the remaining records.