COOPY » Guide  version 0.6.5
sspatch

Modify a table/database/spreadsheet to integrate the changes described in a pre-computed difference.

Usage

Index

Option summary

Option details

--act=ACT
filter for an action of a particular type (update, insert, delete, none, schema)

--cmd=CMD
specify an action inline in tdiff format

--default-table=TABLE
name to use when a table name is needed and not supplied

--help
show how to use this program

--inplace
if modifications are made, make them in place without a copy

--input-formats
list supported input database formats

--neither
in case of conflict use cell value from common ancestor

--ours
in case of conflict use cell value that was the local choice

--output=OUTPUTFILE
direct output to this file (default is standard output)

--patch-formats
list supported patch formats

--table=TABLE
filter for a named table of a workbook/database (repeat option for multiple tables)

--theirs
in case of conflict use cell value that wasn't the local choice

Examples

You can generate test file(s) for the examples that follow:

sspatch --test-file directory.sqlite
sspatch --test-file numbers.csv
sspatch --test-file numbers_buggy.csv
sspatch --test-file numbers_buggy.sqlite

Example 1

sspatch numbers_buggy.csv numbers_patch.tdiff

Apply a patch to a table. Output goes to standard output. Input file is untouched.

Example 2

sspatch --inplace numbers_buggy.csv numbers_patch.tdiff

Apply a patch to a table. Input file is modified.

Example 3

sspatch --tmp tmp.sqlite numbers_buggy.sqlite numbers_patch.tdiff

Apply a patch to a sqlite database. Input file is not modified. Space for a temporary database is needed to do this. If not supplied, sspatch will ask for it.

Example 4

sspatch - numbers_patch.tdiff < numbers_buggy.csv

Apply a patch to a table read from standard input.

Example 5

sspatch numbers_buggy.csv - < numbers_patch.tdiff

Apply a patch read from standard input.

Example 6

sspatch --cmd "+ |two|2|" numbers_buggy.csv

Add a new row to a table.

Example 7

sspatch --cmd "- |NAME=four|" numbers.csv

Remove a row from a table

Example 8

sspatch --cmd "= |NAME=four|DIGIT:*->4|" numbers_buggy.csv

Change the DIGIT column on a row with NAME=four.

Example 9

sspatch --inplace  --table organizations \
--cmd "+ |42|The New Organization|" directory.sqlite

Add an organization. The specified organization ID is replaced by an autoincremented ID generated by sqlite. Use 'ssformat directory.sqlite' to view result.

Example 10

sspatch --native --inplace  --table organizations \
--cmd "+ |42|The New Organization|" directory.sqlite

Add an organization. The specified organization ID is used (due to --native flag). Use 'ssformat directory.sqlite' to view result.

Patch formats

Database/spreadsheet file formats

CSV: plain-text delimiter-separated family of formats

SQLITE: file-based database

SQLITEXT: sqlite-format sql dump

JSONBOOK: Spreadsheet formats in json

GNUMERIC: Spreadsheet formats (via gnumeric)

MDB: Access database format (via Mdbtools, READ-ONLY)

JMDB: Access database format (via Jackcess)

MYSQL: database connector

SOCIALCALC: SocialCalc format (via mozjs)

Version

sspatch version 0.6.5

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines