Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue #9 #10

Closed
wants to merge 3 commits into from
Closed

Fixed issue #9 #10

wants to merge 3 commits into from

Conversation

daquintero
Copy link

As described in this issue #9 , I was trying to run this command in the most minimal Prisma example which I created here:

graphql load --csv reviews.txt --mutation corruptionIn --mapping '{ "url" : "commentary", "description" : "stars"}'

With the original graphql-cli-load code, I got this error:

✖ 
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":{}}}

After a lot of research into your source code, I recognized the syntax error was because there was no mapped mutations being built inside buildMutations, and then saw that the rMapping was calling the wrong "key" to select the values from the given csv rows. Changing this to the original mapping, the whole graphql-cli-load worked properly.

@jexp
Copy link
Contributor

jexp commented Sep 10, 2018

Hi,

there is a lot of unrelated changes and debug comments still in there.

Did you also consider the case when there is no mapping passed in? B/c that's what the rMapping was for, then mapping is not existent.


// const column=(rMapping[key]||key).toString(); // original
// console.log("Correcting the key mapping data with const column = mapping[key].toString() is " + (mapping[key]).toString())
const column = mapping[key].toString()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if there is no entry for key in the mapping? Then the original name from the mutation args has to be used.

@jexp
Copy link
Contributor

jexp commented Sep 10, 2018

Please remove all the debug logs, commented out code and whitespace changes, otherwise it's really hard to review the changes.

@daquintero daquintero closed this Oct 20, 2018
@daquintero
Copy link
Author

I had an error with my reference of the json columns, so there was no problem with the source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants