guillotina icon indicating copy to clipboard operation
guillotina copied to clipboard

Document new posibilities with postgresql json catalog

Open jordic opened this issue 4 years ago • 1 comments

Till version 5 having the state serialized as jsonb, or later having the catalog as a jsonb field, opens a lot of new possibilities for guillotina, something trivial like exporting objects to a csv, could be done as easy as:

\copy (select id, json->>'nombre' as nombre, json->>'tipo' as tipo) from guillotina.objects where type='Producto' to '/tmp/objects.csv' with csv;

I don't see it, just as a something around guillotina, but also as something that makes guillotina open to the rest of tooling (The tradeoff of pickles, is that they live only on python)

Other things that could also be implemented (perhaps interesting), having a new implementation for bucket fields (that instead of being blobs), they are tables on postgres. This makes trivial to query them or fetch/update/delete without waking up all blob objects. As an example, you store on a object reactions from a user, with this kind of field, you can just filter by user ...

There is also another path to explore, to make relations better, they colud be build around the zoid of objects. (currently we only support one to many, as a tree), but something like for example, related posts, could be implemented as related zoids (for the object)

And another one, that could be explored is to just query the security directly, for example, if we want to traverse to /x/a/b/c .. we can just fetch all security objects with a single roundtrip to pg, and determine if we are able to access the object. (later fetch the latest object as usual... ) This could speed up the traversal mechanics...

So sorry, perhaps is too much for a single issue, but I just want to share with yours these small features, that I think could make guillotina more awesome...

Will try to create a blog post, or doc, with such kind of features that can be built with it.

Amyway, what will be the tradeoffs of having the state serialized only as jsonb. (at least on postgres)? I know that storing binary data would be a pain... but for the rest of cases... Postgres12 introduces a new function to query jsonb fields with json path expressions jsonb_path_query(a, '$.name')

jordic avatar Oct 29 '19 05:10 jordic