question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

After adding computed columns, GraphQL schema returns empty

See original GitHub issue

This could easily be me not knowing how to create the computed column, or trying to create it in a way that is not supported.
But after I created it the GraphQL schema is blank.

Here are the steps to reproduce it.

CREATE TABLE public.calistings
(
    id uuid NOT NULL DEFAULT gen_random_uuid(),    
    location geometry(Point,4326)
)
CREATE FUNCTION calc_calisting_distance(calisting_row calistings,location json)
 RETURNS INTEGER AS $$
   SELECT ST_DISTANCE(calisting_row.location::geography, ST_GeomFromGeoJSON(location::text)::geography)::integer
 $$ LANGUAGE sql STABLE;
{
    "type":"add_computed_field",
    "args":{
        "table":{
            "name":"calistings",
            "schema":"public"
        },
        "name":"distance",
        "definition":{
            "function":{
                "name":"calc_calisting_distance",
                "schema":"public"
            },
            "table_argument":"calisting_row"
        }
    }
}

After I create the computed column, using the query endpoint. The GraphQL schema, from the intropsection query, is returned blank. If I remove the computed column, the introspection query returns the schema.

Tried checking the logs in the graphql-engine but no error is shown. I can see the introspection query hitting the server and responding with a 200 status OK.

I think the issue might be in the way I am creating the computed column. I didn’t see a way to pass the function arguments to the api. Only the row name and type.

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
tafelitocommented, Oct 25, 2019

thanks @leoalves

I actually found that the issue are not the computed fields themselves. The problem is with the functions. If you untrack the functions, then the schema shows up again and you can still query the computed fields

1reaction
OLDINcommented, Jan 21, 2020

I support tafelito’s answer, the problem still exists in version v1.1.0-beta.2 And because of this, exporting the scheme to SDL does not work.

Error: Introspection must provide input type for arguments.
Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL : Error while adding computed fields - Stack Overflow
GraphQL : Error while adding computed fields ; CREATE OR REPLACE FUNCTION ; RETURNS TEXT AS $$ BEGIN ; SELECT userrow.first_name || '...
Read more >
How to Check if a Value is Empty in GraphQL | StepZen blog
Is it possible to check if a value returned by a GraphQL query is empty or not? This article explains how to tackle...
Read more >
Customizing the behavior of cached fields - Apollo GraphQL
The first parameter is the field's currently cached value (if one exists). You can use this to help calculate the value to return....
Read more >
Nulls in GraphQL: Cheatsheet - Hasura
Nulls in the query ... A GraphQL query can have fields and inputs, with or without variables. Fields are always optional, whether nullable...
Read more >
Administrative API - GraphQL - Dgraph
On first starting with a blank database: There's no schema served at /graphql . Querying the /admin endpoint for getGQLSchema returns "getGQLSchema": ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found