You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/09/07 06:42:01 UTC

[GitHub] [incubator-superset] villebro commented on issue #10754: Explore PostgreSQL Datasource with JSONB array ERROR

villebro commented on issue #10754:
URL: https://github.com/apache/incubator-superset/issues/10754#issuecomment-688072157


   @GiannisDimitriou I am unable to reproduce the bug on master branch against a Postgres 10.4 database. The query
   ```sql
   SELECT *
   FROM (SELECT '[{"transaction_status":"SUCCESS","transaction_id": 1}]'::jsonb AS abc) AS x 
   WHERE x.abc @> '[{"transaction_status":"SUCCESS","transaction_id": 1}]' 
   ```
   renders fine in both SQL Lab and when in Explore view:
   ![image](https://user-images.githubusercontent.com/33317356/92355255-899df500-f0ec-11ea-9961-8b1a77b4244d.png)
   Are there perhaps additional filters that you're trying to apply on `JSONB` columns? I propose breaking out any fields you need using `JSON` get operators: https://www.postgresql.org/docs/10/functions-json.html. For example, if your `JSONB` column contains an object with the key `transaction_id`, you can easily break that out into a separate column that can then be used as a regular column in your datasource. Example below of how superset renders the query when applying a filter on the (integer cast) value of `transaction_id`:
   ![image](https://user-images.githubusercontent.com/33317356/92356058-2745f400-f0ee-11ea-86b0-b0b09f46ae62.png)
    


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org