Project

taps2

0.0
No commit activity in last 3 years
No release in over 3 years
A simple database agnostic import/export app to transfer data to/from a remote database.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 1.2.1
>= 0
>= 1.3.8

Runtime

>= 0
>= 1.3
>= 1.4.0
>= 4.0
>= 1.4.4
 Project Readme

Taps (2) -- simple database import/export app

A simple database agnostic import/export app to transfer data to/from a remote database.

Forked and updated with fixes and improvements. Integrates fixes and updates from taps-taps and tapsicle forks.

Installation

Renamed gem

$ gem install taps2

By default, Taps will attempt to create a SQLite3 database for sessions. Unless you specify a different database type, you'll need to install SQLite3. (See Environment Variables for alternative session databases.)

$ gem install sqlite3

Install the gems to support databases you want to work with, such as MySQL or PostgreSQL.

$ gem install mysql2
$ gem install pg

Configuration: Environment Variables

All environment variables are optional.

The TAPS_DATABASE_URL variable specifies the database URI where session data is stored on CLI or Server. The DATABASE_URL variable is a fallback (and compatible with Heroku) if TAPS_DATABASE_URL is not specified. By default, Taps will create a SQLite3 database.

The TAPS_LOGIN and TAPS_PASSWORD variables are used for default Basic Authentication.

The TAPS_YAML_ENGINE variable lets you specify a YAML engine such as "psych".

The NO_DEFAULT_DATABASE_URL variable allows you to require a database URI be sent in the body of the request that initiates a Taps session. (Default behavior will use the database URI specified when starting the server.)

The NO_DUMP_MARSHAL_ERRORS variable allows you to disable dumping of marshalled data that caused an error.

The NO_DEFLATE variable allows you to disable gzip compression (Rack::Deflater) on the server.

Usage: Server

Here's how you start a taps server

$ taps2 server postgres://localdbuser:localdbpass@localhost/dbname httpuser httppassword

You can also specify an encoding in the database url

$ taps2 server mysql://localdbuser:localdbpass@localhost/dbname?encoding=latin1 httpuser httppassword

Usage: Client

When you want to pull down a database from a taps server

$ taps2 pull postgres://dbuser:dbpassword@localhost/dbname http://httpuser:httppassword@example.com:5000

or when you want to push a local database to a taps server

$ taps2 push postgres://dbuser:dbpassword@localhost/dbname http://httpuser:httppassword@example.com:5000

or when you want to transfer a list of tables

$ taps2 push postgres://dbuser:dbpassword@localhost/dbname http://httpuser:httppassword@example.com:5000 --tables logs,tags

or when you want to transfer tables that start with a word

$ taps2 push postgres://dbuser:dbpassword@localhost/dbname http://httpuser:httppassword@example.com:5000 --filter '^log_'

Troubleshooting

  • "Error: invalid byte sequence for encoding" can be resolved by adding encoding to database URI (ricardochimal#110)
    • Example: taps2 server mysql://root@localhost/example_database?encoding=UTF8 httpuser httppassword
  • SQLite3 database URI may require three slashes (e.g. sqlite3:///path/to/file.db)
    • Make sure to use an absolute/full path to the file on the server

Known Issues

  • Foreign key constraints get lost in the schema transfer
  • Indexes may drop the "order" (ricardochimal#111)
  • String fields with only numbers may get parsed as a number and lose leading zeros or add decimals (ricardochimal#106)
  • Tables without primary keys will be incredibly slow to transfer. This is due to it being inefficient having large offset values in queries.
  • Multiple schemas are currently not supported (ricardochimal#97)
  • Taps does not drop tables when overwriting database (ricardochimal#94)
  • Oracle database classes not fully supported (ricardochimal#89)
  • Some blank default values may be converted to NULL in MySQL table schemas (ricardochimal#88)
  • Conversion of column data types can cause side effects when going from one database type to another
  • Passwords in database URI can cause issues with special characters (ricardochimal#74)

Feature Requests

  • Allow a single Taps server to serve data from different databases (ricardochimal#103)

Meta

Maintained by Joel Van Horn

Written by Ricardo Chimal, Jr. (ricardo at heroku dot com) and Adam Wiggins (adam at heroku dot com)

Early research and inspiration by Blake Mizerany

Released under the MIT License: http://www.opensource.org/licenses/mit-license.php

http://github.com/ricardochimal/taps

Special Thanks to Sequel for making this tool possible http://sequel.rubyforge.org/