Coder Social home page Coder Social logo

Comments (7)

kantum avatar kantum commented on June 25, 2024

Hello, I would love to see the documentation "here's a good set of defaults for hasura".

from genqlient.

nathanstitt avatar nathanstitt commented on June 25, 2024

Hi @benjaminjkraft, thanks so much for the attention to this issue. I'm happy to answer any questions and pitch in on fine-tuning any tests you can think up.

I currently have a mid-size hasura schema with ~50 tables and a 35,720 line GQL schema dump 😭 I'll attach my current schema and the server's config & graphql file in hopes they're helpful.

I'm fortunate that most of my queries are done on the front-end and only sensitive admin-level ones are performed in go on the server. I currently have 12 mutations and 27 queries in my server-side code.

With the changes discussed in #149 and the use_struct_references: true config option coupled with numerous directives like: @genqlient(for: "account_insert_input.created", pointer: true, omitempty: true) it's been working well for me.

The largest issue I'm now facing is that I have timestamp columns mapped to time.Time but that causes mutations to insert 0 as a default value unless I add directives like the above. Then the trigger on the table sees the 0 and doesn't set the value to now() as it should. It's not quite risen to the level of digging in and making a PR for it, but it's on the TODO list.

Looking at my config, I'm also reminded that I fought with jsonb columns and finally just ended up using 'interface{}` and parsing internally. I only have one or two columns of jsonb, so it's not been a large issue for me.

schema-and-config.zip

from genqlient.

StevenACoffman avatar StevenACoffman commented on June 25, 2024

AFAICT, The Hasura GraphQL Engine serves a Relay-based schema for PostgreSQL tables which have a primary key defined.

As a result, I would think #78 for Relay specific issues is relevant.

Better support for Relay APIs, in general, would help not only Hasura, but Github API, and a number of other providers.

from genqlient.

dharijanto avatar dharijanto commented on June 25, 2024

Hi @benjaminjkraft , thanks a lot for paying attention to Hasura users, really appreciate it! :)

hasura seems to now consider explicit null an error at least for all inputs if I'm understanding right?

Not necessarily. Explicit null will not be an error for the following scenario. Instead, it will set the field to NULL validly. If we want it to fallback to "DEFAULT" value, however, we would need to omit the field altogether.
image

First of all, one theory -- already very possible -- is to say you just want to #260 (comment). This is obviously less flexible, which in the common case is arguably good but doesn't scale well

This is a very good observation! I think this is the answer for Hasura user. A client library I'm using in Flutter (https://github.com/heftapp/graphql_codegen) behaves this way and so far I haven't encountered issues using it with Hasura. Indeed it generates quite a lot of structures because it generates 1:1 structure for each of the GraphQL input, but I found it quite nice because it's easier to wrap my head around it.

from genqlient.

joshhayes-sheen-vt avatar joshhayes-sheen-vt commented on June 25, 2024

I'm not sure whether it's backed by Hasura or not, but I'm seeing similar problems when querying the graphql interface of https://www.datocms.com/, specifically the explicit vs implicit null, but also the complex/self-referential types which make application of per-type directives much harder

from genqlient.

kevinmichaelchen avatar kevinmichaelchen commented on June 25, 2024

Apologies if this has been reported elsewhere... I see a lot of value around polymorphic bulk mutations with conditionally present batch insert inputs... I wrote more about this problem here.

from genqlient.

partounian avatar partounian commented on June 25, 2024

I've also had to set use_struct_references: true and optional: pointer to make inputs to mutations for Braintree's / PayPal's GraphQL work reasonably. https://github.com/braintree/graphql-api/blob/master/schema.graphql

And now that I've gotten to queries, oh boy is this head scratching. If I'm understanding correctly, the issue might be similar to some of them that you're observing with Hasura?
Screen Shot 2023-06-01 at 12 48 37 PM

edit:

Ooh I might be simple minded or lack of docs, but GitHub Copilot seemed to get me the deeply nested query I needed right after making this comment.

from genqlient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.