Skip to content

How to exclude or specifically include fields from having filters auto created #418

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
adiberk opened this issue Dec 27, 2024 · 2 comments

Comments

@adiberk
Copy link

adiberk commented Dec 27, 2024

Is there a way we can explicitly list all the fields we want filters created for? Like maybe in the Meta of the sqlalchemy object type?

@adiberk adiberk changed the title How to exclude fields from having filters auto created How to exclude or specifically include fields from having filters auto created Dec 27, 2024
@andmaster-one
Copy link

Have you got how to do that?

@rcb4by
Copy link

rcb4by commented Apr 23, 2025

@adiberk @andmaster-one if you look in the docstring for ORMField you'll see a param for enabling/disabling filter creation. Modifying an example usage from the same docstring:

            class MyModel(Base):
                id = Column(Integer(), primary_key=True)
                name = Column(String)

            class MyType(SQLAlchemyObjectType):
                class Meta:
                    model = MyModel

                id = ORMField(create_filter=False)       # disable filtering for this field
                name = ORMField(create_filter=True)  # True is default behavior, but we can make it explicit

You can also change the default behavior using the create_filter param on the Meta class

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

4 participants
@adiberk @rcb4by @andmaster-one and others