TACTIC Open Source
"data" json column - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: "data" json column (/showthread.php?tid=194)



"data" json column - Diego - 01-22-2021

Hi all!

whenever an sType is created a jsonb column called "data" get added by default.
I know the data column is used in sthpw/pipeline but I can't find any use of this column in the code for custom sTypes.

Is there any specific purpose for this column?

I'd like to implement line colorization in ViewPanelWdg and I'm wondering if I can use a json key in the data column to store an rgb value.

I'd also like to know if it is ok to use it to store other custom values for which i don't want to add a specific column.


RE: "data" json column - remkonoteboom - 01-22-2021

It is meant to used for custom data that is in addition to the base data model of your solution. There is no inherent dependency in TACTIC for this column so you can use it at will. However, always bear in mind that other plugins may also use this column for their purposes, so you should be careful not to just clear it out. It is generally used as a dictionary, so best practices would be to use your own keys and add to the data structure.

You can access the data with:
data = sobject.get_json_value("data")

You can also access a key element with the following:
value = sobject.get_value("data->my_key")

The expression language will also allow this notation
value = Search.eval("@GET(vfx/shot.data->my_key)")

This column is added automatically just to standardize a location. There is nothing stopping you from using this column or creating your own jsonb column. It's up to your design.


RE: "data" json column - Diego - 01-22-2021

Thanks Remko! Very clear.


RE: "data" json column - listy - 01-24-2021

Every time getting this precious knowledge in the forum, rather than finding it in the documentation, it makes me wonder how many more secrets are hidden from us!


RE: "data" json column - Diego - 01-25-2021

Tactic source base is quite a big one, and writing documentation takes a lot of time and it is not easy.

Thanks to python readability it is possible to get many information from the source but very, very time consuming especially if you didn't follow the "history" of the code.

We could make a joint effort to improve the technical documentation and start doing some PR on the doc repo.

I guess a good start point could be to document the code structure and the main program flow.


RE: "data" json column - dankitchen - 03-09-2021

One area that definitely doesn't get the attention it deserves is the whole Custom Layouts section. I have built multiple systems using only this feature (no custom python files) with custom forms, interfaces, reports, column widgets etc. For example, I have a system I use for managing physical product production and costing for my startup, I have built a property title search and invoicing system. A warehouse shipment registration system (a few years back). All of the custom interfaces, tools etc were built using the Custom Layout Editor

If there was a good way to add to documentation for features like this I am sure I could pitch in here and there.


RE: "data" json column - listy - 03-09-2021

(03-09-2021, 03:34 AM)dankitchen Wrote: One area that definitely doesn't get the attention it deserves is the whole Custom Layouts section.  I have built multiple systems using only this feature (no custom python files) with custom forms, interfaces, reports, column widgets etc. For example, I have a system I use for managing physical product production and costing for my startup, I have built a property title search and invoicing system.  A warehouse shipment registration system (a few years back).  All of the custom interfaces, tools etc were built using the Custom Layout Editor

If there was a good way to add to documentation for features like this I am sure I could pitch in here and there.
Can you showcase this? Very interesting  Sleepy


RE: "data" json column - Diego - 03-09-2021

(03-09-2021, 03:34 AM)dankitchen Wrote: One area that definitely doesn't get the attention it deserves is the whole Custom Layouts section.  I have built multiple systems using only this feature (no custom python files) with custom forms, interfaces, reports, column widgets etc. For example, I have a system I use for managing physical product production and costing for my startup, I have built a property title search and invoicing system.  A warehouse shipment registration system (a few years back).  All of the custom interfaces, tools etc were built using the Custom Layout Editor

If there was a good way to add to documentation for features like this I am sure I could pitch in here and there.

Another great thing of Custom Layouts is the fact that you can easily package them as plugins, one thing I hate is the online ace editor I'm used to pycharm and going back to that editor is a pain.

If you want to contribute di the documentation I believe you can send PRs to https://github.com/Southpaw-TACTIC/TACTIC-Docs



RE: "data" json column - listy - 08-09-2021

(01-22-2021, 04:00 PM)remkonoteboom Wrote: It is meant to used for custom data that is in addition to the base data model of your solution.  There is no inherent dependency in TACTIC for this column so you can use it at will.  However, always bear in mind that other plugins may also use this column for their purposes, so you should be careful not to just clear it out.  It is generally used as a dictionary, so best practices would be to use your own keys and add to the data structure.

You can access the data with:
data = sobject.get_json_value("data")

You can also access a key element with the following:
value = sobject.get_value("data->my_key")

The expression language will also allow this notation
value = Search.eval("@GET(vfx/shot.data->my_key)")

This column is added automatically just to standardize a location.  There is nothing stopping you from using this column or creating your own jsonb column.  It's up to your design.
May be we should add a convinient method that adds the desired dictionary to an existing one?

Something like: append_json_value('data', {'name': 'val'})