#136 avoid JSONB column type
Merged by dcallagh. Opened by dcallagh.
dcallagh/waiverdb issue-134-take-2  into  master

Download 136.patch

We want to stay compatible with Postgres 9.2 which lacks the JSONB
column type.

We can use the older JSON column type instead, but it needs some extra
massaging to allow equality comparisons across JSON values. (JSONB
handles this itself.)

The short version is: we compare JSON values as strings, which means we
also need to ensure the string serialization is always consistent when
we send it to the database. The sort_keys=True argument to JSONEncoder()
gives us that.

Fixes #134.

Alternative to PR#135. This version uses a custom SQLAlchemy column type to encapsulate the necessary CAST() stuff for equality comparisons. I like this version a bit nicer, although the custom type requires some ridiculous hacks (the _PGJSON thing).

Also, this doesn't help for the GROUP BY clause which still needs an explicit CAST(), unfortunately.

Both look fine to me.
I really don't like the cast thing :( but I guess we don't have a choice.

Yeah - my vote is on this one too.

@dcallagh, merge away!

1 new commit added

  • tweak for SQLAlchemy 1.0 compatibility (EPEL7)

Pull-Request has been merged by dcallagh

Metadata