All Projects → neo4j-graphql → graphql-cli-load

neo4j-graphql / graphql-cli-load

Licence: other
A graphql-cli data import plugin to call mutations with data from JSON/CSV files

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to graphql-cli-load

csv2influx
A CLI tool for importing CSV files into Influxdb
Stars: ✭ 16 (-74.6%)
Mutual labels:  import, csv-import
cuba-component-data-import
CUBA component for easy data import
Stars: ✭ 19 (-69.84%)
Mutual labels:  data-import, csv-import
react-apollo-form
Build React forms based on GraphQL APIs.
Stars: ✭ 195 (+209.52%)
Mutual labels:  mutations
webpack-async-chunk-names-plugin
No description or website provided.
Stars: ✭ 12 (-80.95%)
Mutual labels:  import
knockout
Knockout aims to extend the basic importing mechanisms in Python3 by allowing more exotic stuff to be added to sys.path.
Stars: ✭ 12 (-80.95%)
Mutual labels:  import
migration
TYPO3 Migration Framework for every kind of migration/imports from CLI (e.g. Templavoila to Gridelements, tt_news to news, etc...)
Stars: ✭ 52 (-17.46%)
Mutual labels:  import
buttercup-importer
🎣 3rd-party archive importer for Buttercup
Stars: ✭ 39 (-38.1%)
Mutual labels:  import
Miller
Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON
Stars: ✭ 4,633 (+7253.97%)
Mutual labels:  json-data
jsonfiddle
JSON Fiddling
Stars: ✭ 14 (-77.78%)
Mutual labels:  json-data
cerebra
A tool for fast and accurate summarizing of variant calling format (VCF) files
Stars: ✭ 55 (-12.7%)
Mutual labels:  mutations
importtool
General data import tool for IgorPro
Stars: ✭ 19 (-69.84%)
Mutual labels:  import
dumbmutate
Simple mutation-testing
Stars: ✭ 32 (-49.21%)
Mutual labels:  mutations
tradeship
Automatically imports missing JavaScript dependencies and removes unused ones.
Stars: ✭ 42 (-33.33%)
Mutual labels:  import
graphql-schema-diff
📄🔄📄 Returns the diff of two GraphQL schemas. Detects dangerous and breaking changes.
Stars: ✭ 54 (-14.29%)
Mutual labels:  graphql-schema
krates
📦 A free HTTP based JSON storage service
Stars: ✭ 36 (-42.86%)
Mutual labels:  json-data
get-css-data
A micro-library for collecting stylesheet data from link and style nodes
Stars: ✭ 29 (-53.97%)
Mutual labels:  import
open2fa
Two-factor authentication app with import/export for iOS and macOS. All codes encrypted with AES 256. FaceID & TouchID support included. Written with love in SwiftUI ❤️
Stars: ✭ 24 (-61.9%)
Mutual labels:  import
flextures
This plug-in can load and dump test data in databases, loading function is very flexible, dump function is very simple
Stars: ✭ 21 (-66.67%)
Mutual labels:  csv-import
graphql-api
GraphQL-Api is an opinionated Graphql framework for Rails that supports auto generating queries based on Active Record models and plain Ruby objects
Stars: ✭ 58 (-7.94%)
Mutual labels:  graphql-schema
cassandra-exporter
Simple Tool to Export / Import Cassandra Tables into JSON
Stars: ✭ 44 (-30.16%)
Mutual labels:  import

graphql-cli-load

Data import plugin for graphql-cli.

Installation

npm i -g graphql-cli graphql-cli-load

Configuration

Configure the plugin via the .graphqlconfig or command line.

The schema will be obtained from the schemaPath key, you can fetch it via graphql get-schema

All other options such as csv, json, mutation or mapping can be placed in the extensions.load key or provided via commandline.

Here is an example:

.graphqlconfig

{
  "schemaPath": "schema.graphql",
  "includes": [
    "src/**/*.graphql",
    "src/**/*.gql",
  ],
  "extensions": { 
    "load": { // this section is optional
      "csv" : "reviews.txt",
      "mutation": "createReview",
      "mapping": { "text" : "review", "rating" : "stars"}
    }
  }
}

Usage

You can now run:

graphql load

or

graphql load --csv reviews.txt --mutation createReview2 --mapping '{ "text" : "commentary", "rating" : "stars"}'

Using endpoint starwars: http://localhost:7474/graphql/
Using mutation "createReview2".

Done parsing CSV-file /Users/mh/d/js/graphql-cli-load/example/reviews.txt rows: 3
 meta: {"delimiter":"\t","linebreak":"\n","aborted":false,"truncated":false,"cursor":566,"fields":["episode","text","rating"]}

Using mapping: {"text":"commentary","rating":"stars"}

Sending query:
mutation { 
_0 : createReview2 ( episode: NEWHOPE,commentary: "A legendarily expansive and ambitious start to the sci-fi saga, George Lucas opened our eyes to the possibilities of blockbuster filmmaki...

✔ Call succeeded:
{"_0":"Nodes created: 1\nProperties set: 3\nLabels added: 1\n","_1":"Nodes created: 1\nProperties set: 3\nLabels added: 1\n","_2":"Nodes created: 1\nProperties set: 3\nLabels added: 1\n"}...

Options

/usr/local/bin/graphql load [--json] [--csv] [--endpoint] [--mutation] [--mapping] [--delim]

Optionen:
  --help          Hilfe anzeigen                                       [boolean]
  --mapping, -p   name mapping of input to mutation (json)
  --mutation, -m  mutation to call
  --endpoint, -e  endpoint name to use
  --json, -j      json file to load
  --csv, -c       csv file to load
  --delim, -d     delimiter for arrays   

Which will take each line of the csv or json file and call the mutation on the endpoint with the data (optionally mapping columns). Non-absolute files are resolved relative to the directory containing .graphqlconfig.

Test with Neo4j-GraphQL Extension

To test this with the neo4j-graphql extension:

  1. npm install -g neo4j-graphql-cli
  2. git clone https://github.com/neo4j-graphql/graphql-cli-load && cd example
  3. neo4j-graphql example-schema.graphql (remember the auth header)
  4. npm install -g graphql-cli graphql-cli-load
  5. Run graphql to install the endpoint, and manually add the auth-header to .graphqlconfig, like here:
"endpoints": {
  "starwars": {"url":"http://localhost:7474/graphql/","headers":{"Authorization": "Basic bmVvNGo6dGVzdA=="}}
},
  1. Run graphql load --csv reviews.txt or graphql load --csv reviews.json
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].