View in #general on Slack
@Damon_S.: I’ve seen the
contains filter: https://cube.dev/docs/query-format#filters-operators-contains. However, is it possible to have these types of operators work on a Postgres JSON field, e.g.,
mytable.mycolumn ->> 'importantkey'?
Query Format | Cube.js Docs
Answering my own question, it is: https://stackoverflow.com/questions/59327256/how-to-deal-with-jsonb-objects-in-postgres-databases-in-cube-js
Stack Overflow: How to deal with jsonb objects in postgres databases in cube.js?
@Igor_Lukanin: @Damon_S. Great that you’ve figured it out
A few months ago I was doing a similar project with Cube.js + Postgres with JSON blobs, and — quite obviously — I found out that such JSON accessors work quite slowly. So, obviously, you should consider building a rollup pre-aggregation over such a dimension. If for some reason you decide not to, I would suggest at least exposing this field in your SQL for the cube like this…
sql: `SELECT *, mycolumn ->> importantkey as importantkey from mytable`
…and then at least creating an `originalSql` pre-aggregation to not hit the raw data when querying the cube. Hope it would help!
![Damon_S.] **@Damon_S.:** Alas, I don't have write access to said schema as mentioned here: [https://cube.dev/docs/pre-aggregations](https://cube.dev/docs/pre-aggregations)
> Pre-aggregations | Cube.js Docs