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

Schema only usage without configuration #565

Closed
ansarizafar opened this issue Aug 26, 2017 · 5 comments
Closed

Schema only usage without configuration #565

ansarizafar opened this issue Aug 26, 2017 · 5 comments
Milestone

Comments

@ansarizafar
Copy link

Thanks for amazing work.
I am using Postgraphile as a library and I also want to execute a query on the server without having to go through HTTP. My question is why it is to provide a pool and other configuration, why not Postgraphile just expose excuteQuery/excuteMutation functions as all other configurations are already set.

@benjie
Copy link
Member

benjie commented Aug 26, 2017

We provide the tooling (such as withPostGraphQLContext and createPostGraphQLSchema) so that you may execute queries using "graphql" itself. By doing this we allow you to make optimisations, should you so desire, e.g. Skipping the verification phase and jumping straight to execute. And of course running queries on your schema with "graphql" function is the standard way throughout the GraphQL ecosystem.

Further reading that may interest you: #209

@ansarizafar
Copy link
Author

Thanks for the info but this means graphql schema / connection pool will be created twice. It would be great If Postgraphile can at least expose schema/connection pool if not higher order query execute function.

@benjie
Copy link
Member

benjie commented Aug 26, 2017

You can pass in a shared pool to both so the pool needn't be created twice, I don't think the schema being generated twice is a huge deal - it's only done at server startup and it doesn't consume much memory but I'm open to a PR that would allow passing the schema in to the postgraphql middleware function if it's simple enough.

@ansarizafar
Copy link
Author

Postgrapgile has made a developer's life very easy. Ideally, I would still request a query execute function exported from Postgraphile.

@benjie
Copy link
Member

benjie commented Aug 15, 2018

The current status on this is that you can copy the performQuery function from the docs and use that: https://www.graphile.org/postgraphile/usage-schema/

I'm going to leave this open though, because we can still do better.

@benjie benjie modified the milestones: 5.0, 4.1 Aug 16, 2018
benjie added a commit that referenced this issue Jan 27, 2020
* chore(tsdoc): enable TSDoc linting (#577)

* chore: add tests for GRAPHILE_TURBO (#582)

* chore(types): export GraphileResolverContext

* chore(release): use yarn commands

* feat(watch): manual schema reload notification (#583)

* chore(git): ignore .env file (#590)

* chore(tests): use Jest GraphQL schema serializer (#589)

* feat(omit) take "many" on constraints into account (#565)

* feat(omit) take "many" on constraints into account

Closes #505.

* move `@omit many` constraint condition to "many" relations only

and simplify the conditions a bit, outdenting `makeField` by one level

Co-authored-by: Benjie Gillam <[email protected]>

* feat(pg): support non-scalar range values (#591)

Co-authored-by: Benjie Gillam <[email protected]>

* Fix issues after rebase

* More reliable?

Co-authored-by: David Baumgold <[email protected]>
Co-authored-by: Andreas Bergmaier <[email protected]>
benjie added a commit that referenced this issue Jan 28, 2020
* feat(omit) take "many" on constraints into account

Closes #505.

* move `@omit many` constraint condition to "many" relations only

and simplify the conditions a bit, outdenting `makeField` by one level

Co-authored-by: Benjie Gillam <[email protected]>
@benjie benjie closed this as completed Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants