In my postgresql database there is a table which has a column with an integer data type. I would like to perform a .contains operation using the peewee python orm.
It does not seem to work since the integer value needs to be converted to a string before the comparison can happen. In postgresql you can do value::text and then the integer value will be a string and you can use it in a like expression.
Can i do this using the peewee orm, convert the value first and then use .contains? Or maybe there is another way?
For example i would like to match 20 out of 2022022
Thanks
I found another way to do it. I also tested coleifer's solution above and it works great. I ended up using the postgresql formatting functions https://www.postgresql.org/docs/9.3/static/functions-formatting.html
query.where(fn.TO_CHAR(Url.http_status_code, '999').contains(search_val))