juliotrigo / sqlalchemy-filters

Filter, sort and paginate SQLAlchemy query objects. Ideal for exposing these actions over a REST API.
Other
321 stars 74 forks source link

Support json_contains in JSON field #52

Open iamdavidzeng opened 4 years ago

iamdavidzeng commented 4 years ago

Intro

  1. Add new Operator json_contains to support JSON field in mysql5.7 or higher
  2. Add mysql test for json_contains and ignore sqlite and postgres
  3. Only support sqlalchemy1.3.x or higher for now

More

  1. Not sure format is correct for this repo.
  2. Please let me know if there is something necessary need to add for this PR.

Confused

  1. Can't find sqlite3 version, and sqlalchemy1.1.x or higher support JSON but sqlite will raise an says that:
    CompileError: (in table 'til', column 'refer_info'): Compiler <sqlalchemy.dialects.sqlite.base.SQLiteTypeCompiler object at 0x7f045429d9d0> can't render element of type <class 'sqlalchemy.sql.sqltypes.JSON'>

    I think the error might be cause by sqlalchemy version and restrict it to 1.3.x or higher then test pass.

but still can't figure out why sqlalchemy1.1 and sqlalchemy1.2 will raise such error with sqlite3, any idea about this?

juliotrigo commented 4 years ago

Thank you @iamdavidzeng for your request!

I will review your changes in the next days.

Gijsbertbas commented 3 years ago

@juliotrigo thank you for this great package!

Any chance this PR might be merged and released soon? it would be a nice feature