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

arachne

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arachne

Export insert scripts for data by crawling the relationship graph

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

arachne

Build Status

arachne is a utility for scripting connected subgraphs.

Databases frequently contain multiple independent data sets, especially in multi-tenant systems where client data are stored in the same tables but have no relation to each other. Extracting a single data set is more difficult the more complex the schema, and automated tools like pg_dump are all-or-nothing propositions.

Given a database, a table to start from, and the value of a primary key in that table, arachne crawls the relationship graph to determine the dependency structure and exports the data in a safe order so no row is inserted before data it depends on. The output format is similar to that of pg_dump.

Requirements

Certain criteria must be met in order for arachne to analyze and script a complete dataset:

  • All foreign keys must be explicitly defined.
  • All tables must have primary key constraints, including junction tables.
  • Tenant data must be fully segregated, such that there is no row in any table referenced by data belonging to multiple tenants.
  • There must be no cyclic dependencies (where two rows depend on each other, an impossibility so long as referential integrity is maintained).

Installation

npm i -g arachne

Usage

As an application:

arachne --database mydb mytable 1234

As a module:

const arachne = require('arachne');
const config = {};  // pg connection configuration
const criteria = {id: 1234};

arachne(config, 'sourcetable', criteria).then(script => {...});

Note that with complex schemata and large tables it may take some time to traverse and script everything!

Keywords

FAQs

Package last updated on 01 Jun 2017

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