graphql-engine
graphql-engine copied to clipboard
Cannot include \"XXX.YYY\" in the GraphQL schema because it is not a valid GraphQL identifier
Version Information
Server Version: v2.7.0
Environment
OSS
What is the expected behaviour?
The GraphQL identifier should replace the . character from PostgreSQL field name with _
Keywords
it is not a valid GraphQL identifier
What is the current behaviour?
We're receiving the below error:
[
{
"definition": {
"schema": "xxxx",
"name": "yyyyy"
},
"reason": "Inconsistent object: cannot include \"XXX.YYY\" in the GraphQL schema because it is not a valid GraphQL identifier",
"name": "table xxxx.yyyyy in source default",
"type": "table"
}
]
How to reproduce the issue?
- Create a PostgreSQL column named
XXX.YYY - Try to track the table which contains the created column
- You will receive the above error
Any possible solutions?
Replace . character with _ when generating GraphQL identifier.
Can you identify the location in the source code where the problem exists?
https://github.com/hasura/graphql-engine/blob/6e8da71ece69e363e9fa5bace3cef8a33e51cc5a/server/src-lib/Hasura/Backends/Postgres/SQL/Types.hs#L265
Any idea how can I implement this fix by myself?
I have the same problem but with a - instead of a . (hasura 2.13.0)
I am unable to rename the offending constraint (it's a unique index) because it's not my database
@coco98 @rikinsk can we take a look at this issue?
Related/duplicate issue: #8687
I've ran into this issue too. As far as a potential solution, to
Replace
.character with_when generating GraphQL identifier.
one can do that when calling the API by specifying this choice in args.configuration.column_config field of the request, e.g.
{
"type": "pg_track_table",
"args": {
"source": "dev",
"table": "mytable_v1",
"configuration": {
"column_config": {
"field.blah": {
"custom_name": "field_blah"
}
}
}
}
}
This is what Hasura Console UI does when you track via UI (). Hardcoding this choice of replacing
. with _ into Hasura itself might be not flexible enough for everybody.