Skip to content

Error: QueryParams are immutable when using order. #43

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

Closed
tbrains opened this issue Nov 22, 2021 · 0 comments · Fixed by #57
Closed

Error: QueryParams are immutable when using order. #43

tbrains opened this issue Nov 22, 2021 · 0 comments · Fixed by #57

Comments

@tbrains
Copy link
Contributor

tbrains commented Nov 22, 2021

Get the following error when using order

QueryParams are immutable since 0.18.0. Use q = q.set(key, value) to create an updated copy.

Ex: data = supabase.table('TABLE_NAME').select('*').order("id")

Possible Fix (below): Update order function in class SelectRequestBuilder in request_builder.py

    def order(self, column: str, *, desc=False, nullsfirst=False):
        self.session.params = self.session.params.add("order", f"{column}{'.desc' if desc else ''}{'.nullsfirst' if nullsfirst else ''}")
        return self
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

Successfully merging a pull request may close this issue.

1 participant