Working with JSONB fields


#1

Hello

I am having problems querying JSONB fields from a postgres database. They are set as field containing JSON in metabase.

I can’t seem to build queries that filter correctly on the JSONB values (I get no results or an exception error), and have had no success trying to cast into seperate columns.

Has anyone successfully worked with JSONB data in metabase?

Thanks in advance!


Values json for columns and lines
#2

@Rlmsh
I don’t think JSONB is currently support (go and vote by clicking the :+1: on the first post)


#3

Thanks!


#4

You can work with JSONB with metabase succesfully but it needs to make an architecture to support this. The simplest example is that :

  1. JSONB tables
  2. Views that made a transformation from jsonb to table columns so that when you select the view you see just a table (optional layer that helps to have a ‘table’ like reference.
  3. Stored Procedures that get your filters that will be given from metabase and return a table. At least this is supported into PostgreSQL.
  4. Into metabase, you create custom queries that refer to these Stored Procedures that return tables.
    Metabase can’t distinguish if the select statement refers to an actual table or a stored procedure that returns a table.
    Job done. Have a good luck and a good design.