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

Array filter for postgres #1857

Open
maqueisaprogrammer opened this issue Jan 22, 2025 · 2 comments · May be fixed by #1877
Open

Array filter for postgres #1857

maqueisaprogrammer opened this issue Jan 22, 2025 · 2 comments · May be fixed by #1877
Labels
enhancement New feature or request

Comments

@maqueisaprogrammer
Copy link

maqueisaprogrammer commented Jan 22, 2025

Hi, I am using tortoise.contrib.postgres.fields.ArrayField, my model is as below:

class HelpDoc(BaseModel):
   all_path = ArrayField(description="path", null=True)

the all_path field stores like “[1, 2, 3, 10, 20, 25]" and i want to filter records that contains 2, the sql will like below:
select * from help_doc where all_path @> ARRAY[2]

I don't find any example from the documentation except raw method。But i don't want to use raw method,i Usually use filter method。

can any one help me , thanks!

@henadzit henadzit added the enhancement New feature or request label Jan 28, 2025
@henadzit
Copy link
Contributor

It doesn't seem like it is supported right now. Filtering JSON is supported and documented here. I'm adding the enhancement label to this ticket.

@henadzit
Copy link
Contributor

Possibly a duplicate

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

Successfully merging a pull request may close this issue.

2 participants