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]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS],,
Change log ChangeLog
Dependencies aeson (>=1.0), base (>=4.7 && <5), bytestring (>=0.10.8 && <0.11), cassava (>= && <0.6), clock (>=0.7 && <0.8), console-program (>= && <0.5), containers (>=0.5 && <0.6), logging (>=3.0 && <4), monad-control (>=, 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 (>=, th-utilities (>= && <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
Category Database
Home page
Uploaded by mihaigiurgeanu at 2018-03-17T22:37:13Z
Executables transfer-db
Downloads 1592 total (1 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-

[back to package description]


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

Release Notes

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


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:


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.