How to add dynamic sql based filters to a cube query for a jsonb postgresql column?
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
**Problem**
I have a table that contains a json column. The column will have a structure something like the following. field_id can vary for different accounts and mostly change at runtime, so I cannot define a dimension in the cube.
```javascript
{
"field_id" :"value",
"field_id": ["field_value_1","field_value_2"]
}
```
I want to run queries like the following
```sql
SELECT * FROM my_table
WHERE json_columnn->>'field_id' = queried_value;
```
```sql
SELECT *
FROM my_table
WHERE (json_columnn->'field_id') ?| array['queried_value_1', 'queried_value_2','queried_value_3']
```
Is there a simple way I can achieve this through cube? Is there a way I can specify a filter purely through sql when sending a query? I couldn't find this anywhere in the docs.
If I could generate a cube at runtime with the top level SQL query with these filters and rest of dimensions and filter being handled by cubejs, that would help too.
Contributor guide
Assessment
This issue has not been assessed yet.