Live data from Hacker News

Hasura GraphQL Engine and SQL Server

github.com

71–80 of 85 posts

Re: Hasura GraphQL Engine and SQL Server

#71
post #33

Earlier quoted context omitted.

That's technically true, though Hasura is a well-funded startup with a $99+/mo cloud offering and Enterprise features while postgraphile is one main open-source developer who has support contracts available and accepts donations (the "pro" package is pretty minimal and costs just ~$25/mo). You can get started with Hasura for free which is great, and you can run it on your own servers (if you want to manage a Haskell…

> (if you want to manage a Haskell service) Nowadays most of these self-hosted apps run on Docker containers as a wonderful abstraction. For example, in my company we have self hosted Metabase on App Engine Flex. It is written with Clojure and runs on the JVM. I know nothing about these things, yet I was able to make it run with high availability. You could also run it on Kubernetes or other similar options elsewhere…

That's a good point; I've always assumed this isn't common with Hasura but I honestly have no idea. $99/mo just seems like a great deal if your bandwidth usage fits within the included 20GB/mo.

Re: Hasura GraphQL Engine and SQL Server

#72

I'm overall very impressed with Hasura, but have found it cumbersome to work with if using UUID primary keys because it won't map them as the GraphQL ID type [0]. There are plenty of people using Hasura successfully in production environments, so I'm curious how others handle it. I'm hoping the answer isn't "just use int PKs", but it'd be helpful to know if it is. [0] -- https://github.com/hasura/graphql-engine/issue…

We use UUIDs in production too with Hasura. I remember it was painful to make it work.

Re: Hasura GraphQL Engine and SQL Server

#73

I'm overall very impressed with Hasura, but have found it cumbersome to work with if using UUID primary keys because it won't map them as the GraphQL ID type [0]. There are plenty of people using Hasura successfully in production environments, so I'm curious how others handle it. I'm hoping the answer isn't "just use int PKs", but it'd be helpful to know if it is. [0] -- https://github.com/hasura/graphql-engine/issue…

not really sure what the issue here is we use UUID's exclusively and it maps to a scalar uuid type without any issues do you mind explaining a bit more?

I suppose with a dynamic language, it may not be much of a problem. But, with a statically typed language you end up with a situation where your IDs are not GraphQL ID types and can't be without type coercion. Since the uuid type isn't standard, you need to add some sort of serialization to and from the uuid type. It results in a lot of unnecessary ceremony just to work with IDs.

I could be mistaken, but I think it also creates issues with client libraries that want to cache around an object ID, as the type is not a GraphQL ID.

Re: Hasura GraphQL Engine and SQL Server

#74

I'm overall very impressed with Hasura, but have found it cumbersome to work with if using UUID primary keys because it won't map them as the GraphQL ID type [0]. There are plenty of people using Hasura successfully in production environments, so I'm curious how others handle it. I'm hoping the answer isn't "just use int PKs", but it'd be helpful to know if it is. [0] -- https://github.com/hasura/graphql-engine/issue…

I don't have an answer for you but you do have my curiosity. Why did you choose UUIDs as primary keys?

I guess it's just my default setup now. Beyond not wanting to leak data or have people mess around with URLs, I've had much better luck evenly sharding DB instances with UUIDs. Hasura ostensibly supports both (the option exists to create PKs using UUIDs), but then treats them entirely differently at the GraphQL level.

Re: Hasura GraphQL Engine and SQL Server

#75

I'm overall very impressed with Hasura, but have found it cumbersome to work with if using UUID primary keys because it won't map them as the GraphQL ID type [0]. There are plenty of people using Hasura successfully in production environments, so I'm curious how others handle it. I'm hoping the answer isn't "just use int PKs", but it'd be helpful to know if it is. [0] -- https://github.com/hasura/graphql-engine/issue…

I don't have an answer for you but you do have my curiosity. Why did you choose UUIDs as primary keys?

We built a messenger app, the client can generate the message row locally and cache it immediately upon submitting the row without waiting for the response from the server. As the primary key can be generated client side (it’s a UUID, it’s quasi guaranteed to be unique), there’s no clash with existing IDs server side. By using the optimistic response pattern the message appears in the frontend immediately. Once the response for inserting the row comes back, the message can be updated in case the server decided to set additional columns — all with the same message ID which the server gladly accepted. Wonderful.

Re: Hasura GraphQL Engine and SQL Server

#77

Earlier quoted context omitted.

not really sure what the issue here is we use UUID's exclusively and it maps to a scalar uuid type without any issues do you mind explaining a bit more?

I suppose with a dynamic language, it may not be much of a problem. But, with a statically typed language you end up with a situation where your IDs are not GraphQL ID types and can't be without type coercion. Since the uuid type isn't standard, you need to add some sort of serialization to and from the uuid type. It results in a lot of unnecessary ceremony just to work with IDs. I could be mistaken, but I think it a…

Ok that makes sense.

We are using typescript and graphql-codegen to generate our types and haven't run into that issue.

Re: Hasura GraphQL Engine and SQL Server

#78
post #51

Earlier quoted context omitted.

Can't speak for all dbs, but many use a clustered index on the primary key. In this case, the physical rows are stored in the order of the index, rather than just pointers to the rows. If you are inserting non-sequential data into a clustered index, every insert results in a non-trivial rearrangement of the rows. UUIDs are not sequential, so at scale you will experience performance issues if you are using UUID primar…

> Can't speak for all dbs, but many use a clustered index on the primary key. AFAIK, only MySQL (with InnoDB engine) and SQL Server, AFAIK, do it by default (always for MySQL/InnoDB, and by default unless you create a different clustered index before adding the PK constraint for SQL Server, but even then you can specify a nonclustered PK index.) PG doesn't have clustered indexes at all, DB2 has a thing called cluster…

PG does offer clustering: https://www.postgresql.org/docs/11/sql-cluster.html

Re: Hasura GraphQL Engine and SQL Server

#79

I am now building on Hasura. Love the experience overall, but some aspects are frustrating. For example, setting up authentication for a React Native (Expo) app with Auth0 is quite cumbersome, and the docs are a bit out of date.

I built an Expo app on top of Hasura and rolled my own passwordless authentication mechanism and it was far far easier than using Auth0, imo. Auth was done using serverless functions to send emails with one-time-use tokens, to match the received one-time-use tokens with those generated in the database, and to return JWTs which the clients can use to auth later on and which grant access to different roles (it was an a…

I rolled a very similar solution with django+graphene+hasura

Re: Hasura GraphQL Engine and SQL Server

#80
post #79

Earlier quoted context omitted.

I built an Expo app on top of Hasura and rolled my own passwordless authentication mechanism and it was far far easier than using Auth0, imo. Auth was done using serverless functions to send emails with one-time-use tokens, to match the received one-time-use tokens with those generated in the database, and to return JWTs which the clients can use to auth later on and which grant access to different roles (it was an a…

I rolled a very similar solution with django+graphene+hasura

+1 that's probably my favorite way of doing it - https://github.com/martin-hasura/blog-django-graphql-hasura Even Django REST Framework and Hasura works pretty well cause you get auth + then if you want to do functions you get that for 'free' as well
Post reply on HN