2

I want to implement a suggest search in my project. I use a gino library and wondering how to code a "like" filter in gino code?

Basically i need to write this sql statement in gino code:

SELECT id FROM category WHERE category.name ILIKE '%query%' 

Cant find anything in gino docs.

navy
  • 159
  • 9

1 Answers1

1

At gino main page we can see in examples:

users = await User.query.where(User.nickname.contains("d")).gino.all()

so you can try something like that:

category_obj = await CategiryModel.query.where(
CategiryModel.name.ilike("some_name")
).gino.first()


print(category_obj.id)

And you need to make CategiryModel first.

It's actually a SQLAlchemy query

fromSelect
  • 23
  • 4