2017 © Pedro Peláez
 

library dbtabledump

The database table dumper

image

access9/dbtabledump

The database table dumper

  • Wednesday, December 13, 2017
  • by access9
  • Repository
  • 2 Watchers
  • 11 Stars
  • 3,176 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 19 Versions
  • 6 % Grown

The README.md

License Latest Stable Version Build Status, (*1)

DbTableDump - The Database Table Dumper

DbTableDump is a PHP CLI tool to dump database tables to various formats., (*2)

Installation

Prerequisites

DbTableDump requires PHP 8.1 or higher. A database backend is also required - Supported database drivers are here., (*3)

Some Linux distributions require you to install the JSON and/or DOM extensions separately., (*4)

Composer (directly)

The easiest way to install this tool is via composer, (*5)

``` shell composer require access9/dbtabledump, (*6)



### Composer (via your composer.json) Add the following to your composer.json ``` json "access9/dbtabledump": "*"

When either of the two composer installation methods completes, you can run dbtabledump with:

``` shell vendor/bin/dump, (*7)



### Cloning Of course you can always clone the repository: ``` shell git clone https://github.com/bglover/dbtabledump.git

Make sure you get the required vendor dependencies using composer:, (*8)

``` shell composer update -o, (*9)


- I recommend appending `--prefer-dist` if you don't need the development dependencies. ## Supported Formats - YAML - JSON - Delimited (you choose the delimiter) - XML # Usage ``` shell dump help Usage: [options] command [arguments] Options: --help (-h) Display this help message. --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. Available commands: help Displays help for a command list Lists commands config config:get Get a configuration value. If no options are given, the entire config is printed. config:set Set a configuration value. to to:delimited Dump one or more database tables to a delimited format. to:json Dump one or more database tables to json format. to:xml Dump one or more database tables to xml. to:yaml Dump one or more database tables to yaml format.

Table Dumping to YAML

``` shell dump help to:yaml Usage: to:yaml [-l|--limit="..."] [-w|--where="..."] [-u|--user="..."] [-p|--password="..."] [-o|--host="..."] [-n|--dbname="..."] tables1 ... [tablesN], (*10)

Arguments: tables Space delimited list of tables to dump., (*11)

Options: --limit (-l) Number of rows to limit the output to. This option applies to all tables dumped. --where (-w) Add a where clause to the sql. Clause must be in quotes: -w "name = 'larry'". --user (-u) Optional username. Overrides the user setting in config.yml --password (-p) Optional password. Overrides the password setting in config.yml --host (-o) Optional host. Overrides the host setting in config.yml --dbname (-n) Optional database name. Overrides the dbname setting in config.yml --help (-h) Display this help message. --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output., (*12)



## Table Dumping to JSON ``` shell dump help to:json Usage: to:json [-l|--limit="..."] [-w|--where="..."] [-u|--user="..."] [-p|--password="..."] [-o|--host="..."] [-n|--dbname="..."] [-b|--bitmask[="..."]] tables1 ... [tablesN] Arguments: tables Space delimited list of tables to dump. Options: --limit (-l) Number of rows to limit the output to. This option applies to all tables dumped. --where (-w) Add a where clause to the sql. Clause must be in quotes: -w "name = 'larry'". --user (-u) Optional username. Overrides the user setting in config.yml --password (-p) Optional password. Overrides the password setting in config.yml --host (-o) Optional host. Overrides the host setting in config.yml --dbname (-n) Optional database name. Overrides the dbname setting in config.yml --bitmask (-b) Bitmask to use. May be one or more of JSON_* constants Usage example: `dump to:json -b JSON_PRETTY_PRINT -b JSON_UNESCAPED_SLASHES table` (multiple values allowed) --help (-h) Display this help message. --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. Help: Available JSON constants are: JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT and JSON_UNESCAPED_UNICODE. See http://php.net/manual/en/json.constants.php for more information about what these do.

Table Dumping to a Delimited Format

``` shell dump help to:delimited Usage: to:delimited [-l|--limit="..."] [-w|--where="..."] [-u|--user="..."] [-p|--password="..."] [-o|--host="..."] [-n|--dbname="..."] [-d|--delimiter="..."] [-q|--quote] tables1 ... [tablesN], (*13)

Arguments: tables Space delimited list of tables to dump., (*14)

Options: --limit (-l) Number of rows to limit the output to. This option applies to all tables dumped. --where (-w) Add a where clause to the sql. Clause must be in quotes: -w "name = 'larry'". --user (-u) Optional username. Overrides the user setting in config.yml --password (-p) Optional password. Overrides the password setting in config.yml --host (-o) Optional host. Overrides the host setting in config.yml --dbname (-n) Optional database name. Overrides the dbname setting in config.yml --delimiter (-d) Required delimiter to use. Enclose delimiter in quotes. --delimiter "|" --quote (-q) Quote each delimited column: '"column_one","column_two"', etc --help (-h) Display this help message. --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output., (*15)

Help: The --delimiter option is required. You can use tabs as your delimiter by passing "\t" as the delimiter., (*16)



## Table Dumping to a XML ``` shell dump help to:xml Usage: to:xml [-l|--limit="..."] [-w|--where="..."] [-u|--user="..."] [-p|--password="..."] [-o|--host="..."] [-n|--dbname="..."] tables1 ... [tablesN] Arguments: tables Space delimited list of tables to dump. Options: --limit (-l) Number of rows to limit the output to. This option applies to all tables dumped. --where (-w) Add a where clause to the sql. Clause must be in quotes: -w "name = 'larry'". --user (-u) Optional username. Overrides the user setting in config.yml --password (-p) Optional password. Overrides the password setting in config.yml --host (-o) Optional host. Overrides the host setting in config.yml --dbname (-n) Optional database name. Overrides the dbname setting in config.yml --help (-h) Display this help message. --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. Help: Column names that contain spaces will have the spaces converted to underscores.

Configuration

Initializing your configuration

``` shell dump help config:set Usage: config:set [-u|--user="..."] [-p|--password="..."] [-o|--host="..."] [-n|--dbname="..."] [-d|--driver="..."], (*17)

Options: --user (-u) Username used to connect to the database. --password (-p) Password used to connect to the database. --host (-o) Host the database is on. Either an IP address or a hostname are valid. --dbname (-n) Name of the database used for dump operations. --driver (-d) Driver used to connect to the database. Valid options are pdo_mysql, drizzle_pdo_mysql, mysqli, pdo_sqlite, pdo_pgsql, pdo_oci, pdo_sqlsrv, sqlsrv, oci8 and sqlanywhere. --help (-h) Display this help message. --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output., (*18)



### Retrieving your configuration options. ``` shell dump help config:get Usage: config:get [-u|--user] [-p|--password] [-o|--host] [-n|--dbname] [-d|--driver] Options: --user (-u) --password (-p) --host (-o) --dbname (-n) --driver (-d) --help (-h) Display this help message. --version (-V) Display this application version. --ansi Force ANSI output. --no-ansi Disable ANSI output. Help: If no options are given, the entire config is printed.

Supported Database Drivers

This project uses Doctrine's DBAL., (*19)

The following drivers are support by the Doctrine's DBAL: - pdo_mysql - drizzle_pdo_mysql - mysqli - pdo_sqlite - pdo_pgsql - pdo_oci - pdo_sqlsrv - sqlsrv - oci8 - sqlanywhere, (*20)

There are known issues with the pdo_oci and pdo_sqlsrv drivers. See Doctrine's Driver page for more information if you need to use one of those., (*21)

The Versions

13/12 2017

dev-master

9999999-dev

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

13/12 2017

0.11.0

0.11.0.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

10/04 2017

0.10.1

0.10.1.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

10/04 2017

0.10.0

0.10.0.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

03/04 2017

0.9.1

0.9.1.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

04/10 2016

0.9.0

0.9.0.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

15/12 2015

0.8.6

0.8.6.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

10/12 2015

0.8.5.1

0.8.5.1

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

09/12 2015

0.8.5

0.8.5.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

29/09 2015

0.8.4

0.8.4.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

14/07 2015

0.8.3

0.8.3.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

25/04 2015

0.8.2

0.8.2.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

06/01 2015

0.8.1

0.8.1.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

01/01 2015

0.8.0

0.8.0.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

30/12 2014

0.7.1

0.7.1.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

21/12 2014

0.7.0

0.7.0.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

19/12 2014

0.6.3

0.6.3.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

18/12 2014

0.6.2

0.6.2.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump

18/12 2014

0.6.1

0.6.1.0

The database table dumper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Brian Glover

cli export yaml dump