# pg-delta-file

> Outputs change-only-update CSV files (or “delta” files) that contain all the necessary actions required to re-synchronize rows in a cloned table.

Latest version **0.0.6** (published 2018-03-20) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install pg-delta-file
pnpm add pg-delta-file
yarn add pg-delta-file
bun add pg-delta-file
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2018-03-20 |
| First published | 2017-07-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 (+9 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 121 |
| Author | Jasvinder Bahra |
| Maintainers | timneedham |
| Keywords | etl, pg, postgresql |

## Links

- npm: https://www.npmjs.com/package/pg-delta-file
- Repository: https://github.com/wmfs/tymly
- Homepage: https://github.com/wmfs/tymly#readme
- Issues: https://github.com/wmfs/tymly/issues
- npm.io page: https://npm.io/package/pg-delta-file

## Dependencies (8)

- [pg](https://npm.io/package/pg.md) 7.4.1
- [boom](https://npm.io/package/boom.md) 7.2.0
- [async](https://npm.io/package/async.md) 2.6.0
- [debug](https://npm.io/package/debug.md) 3.1.0
- [lodash](https://npm.io/package/lodash.md) 4.17.5
- [make-dir](https://npm.io/package/make-dir.md) 1.2.0
- [babyparse](https://npm.io/package/babyparse.md) 0.4.6
- [pg-query-stream](https://npm.io/package/pg-query-stream.md) 1.1.1

## Recent versions

- 0.0.6 (latest) — 2018-03-20
- 0.0.5 — 2017-10-06
- 0.0.3 — 2017-08-19
- 0.0.2 — 2017-07-22
- 0.0.1 — 2017-07-19

## README

# pg-delta-file
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wmfs/tymly/blob/master/packages/pg-delta-file/LICENSE)




> Outputs change-only-update CSV files (or “delta” files) that contain all the necessary actions required to re-synchronize rows in a cloned table.

## Usage

```
const generateDeltaFile = require('pg-delta-file')

generateDeltaFiles(
  since: '2017-07-16T20:37:26.847Z',
  outputFilepath: '/some/temp/dir/people-delta.csv',   
  actionAliases: {
    insert: 'u',
    update: 'u',
    delete: 'd'
  },
  createdColumnName: '_created',
  modifiedColumnName: '_modified',

  tables: [
    {
      tableName: 'people',
      csvColumns: [
        'PERSON', // Just output a literal
        '$ACTION', // Will output 'u' or 'd'
        '$ROW_NUM', // Row counter
        '@social_security_id', /// Column data
        '@first_name',
        '@last_name',
        '@age'    
      ] 
    }
  ],
  
  // Standard callback
  function (err, info) {
    // ...
  }
)
```

## <a name="install"></a>Install
```bash
$ npm install pg-delta-file --save
```

## <a name="license"></a>License
[MIT](https://github.com/wmfs/pg-delta-file/blob/master/LICENSE)

---
_Source: https://npm.io/package/pg-delta-file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
