glue_table_properties
only accepts and returns values as strings
#139
Labels
glue_table_properties
only accepts and returns values as strings
#139
this is an extension of changes discussed here and implemented here.
current situation
The current implementation allows a user to provide an additional key (
glue_table_properties
), which itself must be a dict of key-value pairs to theMetadata
object which when passed toGlueTable().generate_from_meta
withupdate_table_properties
set toTrue
will add the key-value pairs to to the table-properties in the glue data catalog.i.e.
The same is true in reverse when using
GlueTable().generate_to_meta
withget_table_properties
set toTrue
, a metadata object is returned with the table-properties from the glue-catalog available within theglue_table_properties
key.i.e.
why we need more than strings
The current implementation requires the values in the
glue_table_properties
to be strings, however there are many cases where different or more complex data-types could be required. For example primary-keys are often stored as lists, and indeed this is a requirement of model-generation within create-a-derived-table which implements its own extraction of table properties and transforms certain values to lists as required (see here).If we were to migrate model-generation to make use of
generate_to_meta
(which i'd very much like to do!), then we would ideally need a way for mojap-metadata to handle those data-type transformation internally, rather than having to add something custom within our own code.Similarly when using
generate_from_meta
to add the table-properties to the glue-catalog it would provide a simpler user experience if theglue_table_properties
dictionary could be passed with these more complex types with mojap-metadata handling the conversion to string internally before writing to the glue-catalog.proposal
Would probably need to discuss implementation to come up with the simplest, most user-friendly approach. One possible suggestion is to provide an optional schema for
glue_table_properties
which mojap-metadata can then use to do any conversions it needs and raise meaningful exceptions if those transformations fail.i.e.
it seems like there is a fair amount of functionality in
metadata.py
which handle data-type transformations with it may be possible to use/extend for these purposes.The text was updated successfully, but these errors were encountered: