sqlalchemy-filters icon indicating copy to clipboard operation
sqlalchemy-filters copied to clipboard

Support json_contains in JSON field

Open iamdavidzeng opened this issue 4 years ago • 2 comments

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?

iamdavidzeng avatar Jun 17 '20 09:06 iamdavidzeng

Thank you @iamdavidzeng for your request!

I will review your changes in the next days.

juliotrigo avatar Sep 04 '20 16:09 juliotrigo

@juliotrigo thank you for this great package!

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

Gijsbertbas avatar Feb 07 '21 20:02 Gijsbertbas