Skip to content

Pre parse query modification #10697

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

Open
jsulopzs opened this issue Mar 1, 2025 · 3 comments
Open

Pre parse query modification #10697

jsulopzs opened this issue Mar 1, 2025 · 3 comments
Labels
k/enhancement New feature or improve an existing feature

Comments

@jsulopzs
Copy link

jsulopzs commented Mar 1, 2025

Component

GraphQL Engine

Is your proposal related to a problem?

I'm developing a data API where users could query data from X days.

Free: last day
Paid: las year
Paid pro: full historical

Describe the solution you'd like

Ideally, I'd like to apply the filters based on user role, which could be done through model permissions.

But now that I have tried plugins and see the many and great applications that can be applied by modifying the internal data prior to parse.

Describe alternatives you've considered

I've considered working it out with hasura model permission, but you can't put PostgreSQL literal, like now() - interval '1 year'.

So I went on to try plugins to modify the query on pre parse query,but it's giving errors because 204 doesn't allow modifications.

They also mention it here: https://hasura.io/blog/introducing-plugins-for-hasura-ddn-an-easy-modular-framework-to-customize-your-api

@jsulopzs jsulopzs added the k/enhancement New feature or improve an existing feature label Mar 1, 2025
@jsulopzs
Copy link
Author

jsulopzs commented Mar 1, 2025

I've thought about recalling the hasura endpoint with the modified query, is this a good approach or are there any better alternatives?

@seanparkross
Copy link
Contributor

Hi there. Is your question that you're getting an error trying to modify the query in a plugin with pre-parse?

@jsulopzs
Copy link
Author

jsulopzs commented Mar 3, 2025

Hi there. Is your question that you're getting an error trying to modify the query in a plugin with pre-parse?

Yes, although the docs say it's not possible. At the end, I've found a way to modify the query to filter data access through roles and session variables.

Still, it'd be great to have such a feature: modify the query through the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/enhancement New feature or improve an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants