neo4j-graphql / graphql-cli-load Goto Github PK
View Code? Open in Web Editor NEWA graphql-cli data import plugin to call mutations with data from JSON/CSV files
Home Page: https://www.npmjs.com/package/graphql-cli-load
License: Other
A graphql-cli data import plugin to call mutations with data from JSON/CSV files
Home Page: https://www.npmjs.com/package/graphql-cli-load
License: Other
also support input objects
macOS Sierra
Node 9.
i ran graphql init and to get .graphqlconfig:
$ graphql init
? Local schema file path: schema.graphql
? Endpoint URL (Enter to skip): https://api.graph.cool/relay
/v1/cj9o4se940gsu0148s5a4helr
? Name of this endpoint, for e.g. default, dev, prod: server
? Subscription URL (Enter to skip):
? Do you want to add other endpoints? No
? What format do you want to save your config in? JSON
About to write to /Users/shingdev/code/GRAPHCOOL/react-graphql/quickstart-with-relay-modern/.graphqlconfig:
{
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
"server": "https://api.graph.cool/relay/v1/cj9o4se940gsu0148s5a4helr"
}
}
}
? Is this ok? Yes```
then ran graphql get-schema, which saw no changes with the previously existing schema.graphql file which seemed correct.
$ graphql get-schema
Downloading introspection from https://api.graph.cool/relay/v1/cj9o4se940gsu0148s5a4helr
No changes
I then ran graphql load which failed with this json file [https://gist.github.com/idkjs/06d10b7a02edb8e6a2b10cb4608bdaa4] :
$ graphql load -m createCompany --json companies.json
Using endpoint server: undefined
Using mutation "createCompany": "".
Done parsing JSON-file /Users/shingdev/code/GRAPHCOOL/react-graphql/quickstart-with-relay-modern/companies.json rows: 90
Sending query:
mutation {
}...
Parameter "url" must be a string, not undefined
I changed the endpoint in graphconfig to this:
{
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
"server": {"url":"https://api.graph.cool/relay/v1/cj9o4se940gsu0148s5a4helr"}
}
}
}
Which produced this error:
```sh
GraphQL Error (Code: 200): {"response":{"error":"Syntax error while parsing GraphQL query. Invalid input \"mutation { \\n\\n}\", expected OperationDefinition, FragmentDefinition or TypeSystemDefinition (line 1, column 1):\nmutation { \n^","status":200},"request":{"query":"mutation { \n\n}","variables":{}}}
This is my graphcool playground mutation def:
This is what the mutation looks like in DevTools if I do one manually
-mutation & variables
mutation CreateCompanyMutation(
$input: CreateCompanyInput!
) {
createCompany(input: $input) {
company {
id
description
logo
}
}
}
{
"input": {
"description": "testatt",
"logo": "https://d25e16a427ed3ce77d27-76b466cd72f6b3a6e7219a8a02851d8e.ssl.cf1.rackcdn.com/files/59382428ff3935425ca91516/size_5_1001pharmaciesjpg.jpg",
"clientMutationId": ""
}
}
Any ideas? Thank you.
I'm trying to load data from a json file, when executing the graphql load command I get the following complains:
Sending query:
mutation {
_0 : createBlabla ( blabla1: 123,blabla2: "blabla2", blabla3: "blabla3 ) { blabla }
_1 : ...
}...
Field "blabla" of type "BlablaType" must have a sub selection.:
If I execute the same mutation from that output in graphql, blabla will expand to blabla { id } and data is successfully added.
P.S. I got the server schema via graphql get-schema
Hello jexp, first thanks for the project, it looks very useful.
I'm having a problem when running the grapqhl load
that maybe you would know what it would mean.
Using endpoint local: {"url":"http://localhost:4000"}
Using mutation "post": "".
Done parsing CSV-file /Users/Me/Desktop/devtest/hackernews-node/reviews.txt rows: 3
meta: {"delimiter":"\t","linebreak":"\n","aborted":false,"truncated":false,"cursor":571,"fields":["episode","commentary","stars"]}
Using mapping: {"description":"commentary","url":"stars"}
Sending query:
mutation {
}...
✖
Syntax Error: Expected Name, found }: {"response":{"errors":[{"message":"Syntax Error: Expected Name, found }","locations":[{"line":3,"column":1}]}],"status":400},"request":{"query":"mutation { \n\n}","variables":{}}}
I'm running the database API with prisma, and I have uploaded my whole minimum viable test project to get this functionality working in this repository: https://github.com/daquintero/testGraphqlCLILoad/tree/master
I'm not sure if this is enough information for the question, but please tell me if you need anything else. I appreciate very much the help!
Hi,
When I run graphql load -m createShipRate --json rates.json
I get:
✖
The "path" argument must be of type string
Hi,
When i run graphql load
i am facing the following error Unknown argument: load
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.