-
-
Notifications
You must be signed in to change notification settings - Fork 568
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
How would I query with UUID id types? #67
Comments
Hi @JurgenJocubeit, see this issue here — #42. The |
I read the thread you suggested and I'm sorry this is all new to me; and I still don't follow. Can I not use UUID primary key types? If I can, how would I query for a single record given an id? I have a vague feeling that what you're saying is that it isn't possible because the id field is accessed via rowID and the new ID is a concatenation of the type and id for Relay compatibility? Can you please help explain this to me... I've only just been exposed to GraphQL and Relay and come from a Rails/ActiveRecord/PostgreSQL/REST background. |
I am pretty new to all of this too So from my understanding you can still use UUID as primary keys however you would query the field with the generated |
Thank you for your responses @ferdinandsalis, I'm glad my understanding is ok. I'll keep playing around, I think since I have taken an existing database which was used for traditional AR access in a REST-based system, I might be missing some fundamental knowledge on how to query. Even though this project generates the queries and mutations, I think I could benefit from some pg functions to make querying easier. |
Hi @JurgenJocubeit, Relay requires that our ids be globally unique so we can always refetch a node no matter the type. Not everyone uses UUIDs, most of the time serial ids are used, so we concatenate the table name with the row ID and base64 encode the thing. That's how we get the ids to be used. Just so you know, it's generally not recommended to manually construct your ID. As a side note, I want to implement fields sometime soon that query by unique constraints, so In the meantime you can implement this exact field by extending PostGraphQL with procedures. |
That's exactly what I want. For instance, in my |
@calebmer thanks for jumping in On 13 Jun 2016 13:39 +0200, Jurgen Jocubeitnotifications@github.com, wrote:
|
@JurgenJocubeit are all your questions answered? |
So Automatic Relation Detection as per the README isn't implemented yet; or is implemented but only for Integer primary keys and not UUIDs? |
No relationship detection for any primary key (compound, Int, string) is implemented. But selecting a single object by its non-global id is not yet supported. And by global id I mean the base64 concatenated version of the table name + the primary key. |
@JurgenJocubeit check out #70 where I implement the |
* feat(graphql): add fields based on unique constraints Closes #67 * fix: allow arbitrary ordering of constraints
I have an existing schema that uses UUIDs for table IDs. I'm finding I get an error when trying to query a field.
GraphiQL has no problem generating the Queries and Mutations.
Awesome project btw.
The text was updated successfully, but these errors were encountered: