@@ -944,6 +944,7 @@ def write(
944944 staged = False ,
945945 validate_index = True ,
946946 index_column : Optional [str ] = None ,
947+ recursive_normalizers : bool = None ,
947948 ) -> VersionedItem :
948949 """
949950 Write ``data`` to the specified ``symbol``. If ``symbol`` already exists then a new version will be created to
@@ -992,6 +993,10 @@ def write(
992993 index_column: Optional[str], default=None
993994 Optional specification of timeseries index column if data is an Arrow table. Ignored if data is not an Arrow
994995 table.
996+ recursive_normalizers: bool, default None
997+ Whether to recursively normalize nested data structures when writing sequence-like or dict-like data.
998+ If None, falls back to the corresponding setting in the library configuration.
999+ The data structure can be nested or a mix of lists and dictionaries.
9951000
9961001 Returns
9971002 -------
@@ -1020,7 +1025,9 @@ def write(
10201025 >>> w = adb.WritePayload("symbol", df, metadata={'the': 'metadata'})
10211026 >>> lib.write(*w, staged=True)
10221027 """
1023- if not self ._allowed_input_type (data ):
1028+ if not self ._nvs ._is_recursive_normalizers_enabled (
1029+ ** {"recursive_normalizers" : recursive_normalizers }
1030+ ) and not self ._allowed_input_type (data ):
10241031 raise ArcticUnsupportedDataTypeException (
10251032 "data is of a type that cannot be normalized. Consider using "
10261033 f"write_pickle instead. type(data)=[{ type (data )} ]"
@@ -1037,10 +1044,17 @@ def write(
10371044 index_column = index_column ,
10381045 norm_failure_options_msg = "Using write_pickle will allow the object to be written. However, many operations "
10391046 "(such as date_range filtering and column selection) will not work on pickled data." ,
1047+ recursive_normalizers = recursive_normalizers ,
10401048 )
10411049
10421050 def write_pickle (
1043- self , symbol : str , data : Any , metadata : Any = None , prune_previous_versions : bool = False , staged = False
1051+ self ,
1052+ symbol : str ,
1053+ data : Any ,
1054+ metadata : Any = None ,
1055+ prune_previous_versions : bool = False ,
1056+ staged = False ,
1057+ recursive_normalizers : bool = None ,
10441058 ) -> VersionedItem :
10451059 """
10461060 See `write`. This method differs from `write` only in that ``data`` can be of any type that is serialisable via
@@ -1062,6 +1076,10 @@ def write_pickle(
10621076 See documentation on `write`.
10631077 staged
10641078 See documentation on `write`.
1079+ recursive_normalizers: bool, default None
1080+ See documentation on `write`.
1081+ If the leaf nodes cannot be natively normalized, they will be pickled,
1082+ resulting in the overall data being recursively normalized and partially pickled.
10651083
10661084 Returns
10671085 -------
@@ -1086,6 +1104,7 @@ def write_pickle(
10861104 prune_previous_version = prune_previous_versions ,
10871105 pickle_on_failure = True ,
10881106 parallel = staged ,
1107+ recursive_normalizers = recursive_normalizers ,
10891108 )
10901109
10911110 @staticmethod
0 commit comments