You can read and write the column descriptions and column typeclasses for your output datasets in Code Respository Transforms.
You can add output column descriptions to your output datasets by providing the optional column_descriptions
argument to the write_dataframe()
function of the TransformOutput.
Copied!1 2 3 4 5 6 7 8 9 10 11 12 13 14
from transforms.api import transform, Input, Output @transform( my_output=Output("/my/output"), my_input=Input("/my/input"), ) def my_compute_function(my_input, my_output): my_output.write_dataframe( my_input.dataframe(), column_descriptions={ "col_1": "col 1 description" } )
The column_typeclasses
property gives back a structured Dict<str, List<Dict<str, str>>>
, which maps column names to their column typeclasses.
List
is a Dict[str, str]
object.
Dict
object must only use the keys "name"
and "kind"
. Each of these keys maps to the corresponding string the user wants.An example column_typeclasses
value would be {"my_column": [{"name": "my_typeclass_name", "kind": "my_typeclass_kind"}]}
.
Copied!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
from transforms.api import transform, Input, Output @transform( my_output=Output("ri.foundry.main.dataset.my-output-dataset"), my_input=Input("ri.foundry.main.dataset.my-input-dataset"), ) def my_compute_function(my_input, my_output): recent = my_input.dataframe().limit(10) existing_typeclasses = my_input.column_typeclasses existing_descriptions = my_input.column_descriptions my_output.write_dataframe( recent, column_descriptions=existing_descriptions, column_typeclasses=existing_typeclasses )