@@ -106,6 +106,7 @@ def __init__(
106
106
AlwaysLogSliceLogger () if emit_connector_builder_messages else DebugSliceLogger ()
107
107
)
108
108
109
+ self ._config = config or {}
109
110
self ._validate_source ()
110
111
111
112
@property
@@ -116,6 +117,12 @@ def resolved_manifest(self) -> Mapping[str, Any]:
116
117
def message_repository (self ) -> MessageRepository :
117
118
return self ._message_repository
118
119
120
+ @property
121
+ def dynamic_streams (self ) -> List [Dict [str , Any ]]:
122
+ return self ._dynamic_stream_configs (
123
+ manifest = self ._source_config , config = self ._config , with_dynamic_stream_name = True
124
+ )
125
+
119
126
@property
120
127
def connection_checker (self ) -> ConnectionChecker :
121
128
check = self ._source_config ["check" ]
@@ -348,13 +355,16 @@ def _stream_configs(self, manifest: Mapping[str, Any]) -> List[Dict[str, Any]]:
348
355
return stream_configs
349
356
350
357
def _dynamic_stream_configs (
351
- self , manifest : Mapping [str , Any ], config : Mapping [str , Any ]
358
+ self ,
359
+ manifest : Mapping [str , Any ],
360
+ config : Mapping [str , Any ],
361
+ with_dynamic_stream_name : Optional [bool ] = None ,
352
362
) -> List [Dict [str , Any ]]:
353
363
dynamic_stream_definitions : List [Dict [str , Any ]] = manifest .get ("dynamic_streams" , [])
354
364
dynamic_stream_configs : List [Dict [str , Any ]] = []
355
365
seen_dynamic_streams : Set [str ] = set ()
356
366
357
- for dynamic_definition in dynamic_stream_definitions :
367
+ for dynamic_definition_index , dynamic_definition in enumerate ( dynamic_stream_definitions ) :
358
368
components_resolver_config = dynamic_definition ["components_resolver" ]
359
369
360
370
if not components_resolver_config :
@@ -393,6 +403,11 @@ def _dynamic_stream_configs(
393
403
# Ensure that each stream is created with a unique name
394
404
name = dynamic_stream .get ("name" )
395
405
406
+ if with_dynamic_stream_name :
407
+ dynamic_stream ["dynamic_stream_name" ] = dynamic_definition .get (
408
+ "name" , f"dynamic_stream_{ dynamic_definition_index } "
409
+ )
410
+
396
411
if not isinstance (name , str ):
397
412
raise ValueError (
398
413
f"Expected stream name { name } to be a string, got { type (name )} ."
0 commit comments