Skip to content
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

Example of direct interaction with postgres #8

Open
dhmacs opened this issue Apr 16, 2020 · 2 comments
Open

Example of direct interaction with postgres #8

dhmacs opened this issue Apr 16, 2020 · 2 comments

Comments

@dhmacs
Copy link

dhmacs commented Apr 16, 2020

Show how to create an action that runs a custom SQL query against the db

@praveenweb
Copy link
Member

@Macs91 - Hi, can you give me a use case of when you want to run custom SQL and not use the built-in GraphQL APIs? I'm thinking all interactions with the db can be again directly done using the auto-generated APIs.

@dhmacs
Copy link
Author

dhmacs commented Apr 23, 2020

@praveenweb I'd say complex transactions are mainly the use case. A scenario that involves complex business logic that should be executed as a transaction (I don't have one concrete example right now).
You may also need to manually optimize a query.

I think that for the sake of the example a trivial query to the database is enough. It just shows that it's straightforward to do and you're not limited to the autogenerated API.

P.S.: I'm asking this because I know people who think that they are limited by Hasura in the interaction with the db, so these would show these people that direct interaction with the db is straightforward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants