Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wmfs/pg-delta-file

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wmfs/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.

  • 1.67.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
959
increased by2993.55%
Maintainers
1
Weekly downloads
 
Created
Source

pg-delta-file

Tymly Package npm (scoped) CircleCI codecov CodeFactor Dependabot badge Commitizen friendly JavaScript Style Guide 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')

const deltaInfo = await 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',
  transformFunction: (row, callback) => { ... } // optional data transformation
  filterFunction: (row) => { ... } // option filter predicate
  dryrun: true // optional flag, set true to return info without generating output file 
  csvExtracts: {
    '[schema.]people': [
      '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'
      '$DATESTAMP',
      '$TIMESTAMP',
      '$DATETIMESTAMP',
    ],
    '[schema2.]address': [
      ...
    ]
  }
)

/*
{
  "totalCount": 5,
  "people": {
    "totalCount": 5
  },
  "address": {
    "totalCount": 3
    "filteredCount": 2
  }
} 
*/

Install

$ npm install pg-delta-file --save

License

MIT

Keywords

FAQs

Package last updated on 12 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc