ambitioninc / django-query-builder

Build complex queries for Django
django-query-builder.readthedocs.org
MIT License
174 stars 33 forks source link

Is it possible to add custom operator in where method? #75

Open un1t opened 8 years ago

un1t commented 8 years ago

Hi!

I use Postgres with jsonb field. I would like to write come expressions like this:

select * from table where data::jsonb @> '{"1" : [8]}';

I did try to put sting as argument in where method.

> Query().from_table('t').where("""data::jsonb @> '{"1" : [8]}""").get_sql()
'SELECT t.* FROM t WHERE ()'
somewes commented 8 years ago

Hey @un1t, there currently isn't support for the "@>" operator or custom ones at the moment. Do you know if that type of operator works with django 1.9's jsonb support? I can look into adding support for this and other jsonb related expressions.

un1t commented 8 years ago

Postgres has many operators for jsonb and other types. Django supports only few of them.