Re: JSONB order?

From: Tony Shelver <tshelver(at)gmail(dot)com>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: JSONB order?
Date: 2020-11-06 07:33:51
Message-ID: CAG0dhZDmunu2JOH=TL89aLEybKguG79T9u5h4gYgEhwOdeDPaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 5 Nov 2020 at 18:27, Rob Sargent <robjsargent(at)gmail(dot)com> wrote:

>
>
> On Nov 5, 2020, at 8:45 AM, Tony Shelver <tshelver(at)gmail(dot)com> wrote:
>
>
>
> ---------- Forwarded message ---------
> From: Tony Shelver <tshelver(at)gmail(dot)com>
> Date: Thu, 5 Nov 2020 at 17:45
> Subject: Re: JSONB order?
> To: Christophe Pettus <xof(at)thebuild(dot)com>
>
>
> Thanks Christophe, that's what I thought.
> Just seemed weird that they were 'disordered' in exactly the same way
> every time.
>
> FYI, as of Python 3.7, dicts *are* ordered.
>
> The problem is that we are possibly going to have many versions of these
> forms with slightly differing keys, which will be a pain to order in some
> hard coded way.
>
>
> Sounds like you’ll need a separate mechanism for maintaining versions of
> the forms and which headers represent the same data concept. Always access
> data via canonical header translated to current form.
>

Did a workaround. For what I needed, I used the python dict to json
function, which creates a string, and then stored that string in a varchar
column on the DB, leaving the json in place for other use.

For reporting, pulled the varchar back and used the json to dict function
on python. Minimal code changes required.

The output is formatted into an Excel spreadsheet, writing the column
header / title from the dict keys, and then formatting the values
underneath.

Not exactly 3rd normal form and all the other best practices, but this is a
hard prototype we have some customers for, so ease of being able to iterate
multiple forms and changes is key.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2020-11-06 08:37:09 Re: how to check that recovery is complete
Previous Message Robert Treat 2020-11-06 02:50:57 Re: Christopher Browne