11from copy import copy
22from typing import Set , Dict , Any , Optional , List
33
4- from dlt .common .configuration import known_sections
4+ from dlt .common .configuration import known_sections , resolve_configuration , with_config
55from dlt .common import logger
6- from dlt .common .configuration .inject import with_config
76from dlt .common .configuration .specs import BaseConfiguration , configspec
87from dlt .common .destination .capabilities import DestinationCapabilitiesContext
98from dlt .common .exceptions import MissingDependencyException
@@ -229,13 +228,16 @@ class ArrowExtractor(Extractor):
229228 - `pandas.DataFrame` (is converted to arrow `Table` before processing)
230229 """
231230
232- # Inject the parts of normalize configuration that are used here
233- @with_config (
234- spec = ItemsNormalizerConfiguration , sections = (known_sections .NORMALIZE , "parquet_normalizer" )
235- )
236- def __init__ (self , * args : Any , add_dlt_load_id : bool = False , ** kwargs : Any ) -> None :
231+ def __init__ (self , * args : Any , ** kwargs : Any ) -> None :
237232 super ().__init__ (* args , ** kwargs )
238- self .add_dlt_load_id = add_dlt_load_id
233+ self ._normalize_config = self ._retrieve_normalize_config ()
234+
235+ def _retrieve_normalize_config (self ) -> ItemsNormalizerConfiguration :
236+ """Get normalizer settings that are used here"""
237+ return resolve_configuration (
238+ ItemsNormalizerConfiguration (),
239+ sections = (known_sections .NORMALIZE , "parquet_normalizer" ),
240+ )
239241
240242 def write_items (self , resource : DltResource , items : TDataItems , meta : Any ) -> None :
241243 static_table_name = self ._get_static_table_name (resource , meta )
@@ -314,7 +316,7 @@ def _write_item(
314316 columns ,
315317 self .naming ,
316318 self ._caps ,
317- load_id = self .load_id if self .add_dlt_load_id else None ,
319+ load_id = self .load_id if self ._normalize_config . add_dlt_load_id else None ,
318320 )
319321 for item in items
320322 ]
@@ -340,7 +342,10 @@ def _compute_table(
340342 # normalize arrow table before merging
341343 arrow_table = self .schema .normalize_table_identifiers (arrow_table )
342344 # Add load_id column
343- if self .add_dlt_load_id and "_dlt_load_id" not in arrow_table ["columns" ]:
345+ if (
346+ self ._normalize_config .add_dlt_load_id
347+ and "_dlt_load_id" not in arrow_table ["columns" ]
348+ ):
344349 arrow_table ["columns" ]["_dlt_load_id" ] = {
345350 "name" : "_dlt_load_id" ,
346351 "data_type" : "text" ,
0 commit comments