@@ -216,19 +216,8 @@ def name(self) -> str:
216
216
stream_name = stream_name [: - len ("Stream" )]
217
217
return stream_name
218
218
219
- def list (self , fields ) -> Iterable :
219
+ def list_records (self , fields ) -> Iterable :
220
220
yield from self .read (partial (self ._api .get , url = self .url ))
221
-
222
- def _filter_dynamic_fields (self , records : Iterable ) -> Iterable :
223
- """Skip certain fields because they are too dynamic and change every call (timers, etc),
224
- see https://github.com/airbytehq/airbyte/issues/2397
225
- """
226
- for record in records :
227
- if isinstance (record , Mapping ) and "properties" in record :
228
- for key in list (record ["properties" ].keys ()):
229
- if key .startswith ("hs_time_in" ):
230
- record ["properties" ].pop (key )
231
- yield record
232
221
233
222
@staticmethod
234
223
def _cast_value (declared_field_types : List , field_name : str , field_value : Any , declared_format : str = None ) -> Any :
@@ -575,7 +564,7 @@ def search(
575
564
# As per their docs: `These search endpoints are rate limited to four requests per second per authentication token`.
576
565
return self ._api .post (url = url , data = data , params = params )
577
566
578
- def list (self , fields ) -> Iterable :
567
+ def list_records (self , fields ) -> Iterable :
579
568
params = {
580
569
"archived" : str (self ._include_archived_only ).lower (),
581
570
"associations" : self .associations ,
@@ -584,7 +573,7 @@ def list(self, fields) -> Iterable:
584
573
generator = self .read (partial (self .search , url = self .url ), params )
585
574
else :
586
575
generator = self .read (partial (self ._api .get , url = self .url ), params )
587
- yield from self ._flat_associations (self ._filter_dynamic_fields ( self . _filter_old_records (generator ) ))
576
+ yield from self ._flat_associations (self ._filter_old_records (generator ))
588
577
589
578
def read (self , getter : Callable , params : Mapping [str , Any ] = None ) -> Iterator :
590
579
"""Apply state filter to set of records, update cursor(state) if necessary in the end"""
@@ -652,7 +641,7 @@ def __init__(
652
641
if not self .entity :
653
642
raise ValueError ("Entity must be set either on class or instance level" )
654
643
655
- def list (self , fields ) -> Iterable :
644
+ def list_records (self , fields ) -> Iterable :
656
645
params = {
657
646
"archived" : str (self ._include_archived_only ).lower (),
658
647
"associations" : self .associations ,
@@ -679,7 +668,7 @@ class CampaignStream(Stream):
679
668
limit = 500
680
669
updated_at_field = "lastUpdatedTime"
681
670
682
- def list (self , fields ) -> Iterable :
671
+ def list_records (self , fields ) -> Iterable :
683
672
for row in self .read (getter = partial (self ._api .get , url = self .url )):
684
673
record = self ._api .get (f"/email/public/v1/campaigns/{ row ['id' ]} " )
685
674
yield {** row , ** record }
@@ -752,7 +741,7 @@ def _transform(self, records: Iterable) -> Iterable:
752
741
if updated_at :
753
742
yield {"id" : record .get ("dealId" ), "dealstage" : dealstage , self .updated_at_field : updated_at }
754
743
755
- def list (self , fields ) -> Iterable :
744
+ def list_records (self , fields ) -> Iterable :
756
745
params = {"propertiesWithHistory" : "dealstage" }
757
746
yield from self .read (partial (self ._api .get , url = self .url ), params )
758
747
@@ -764,12 +753,12 @@ def __init__(self, **kwargs):
764
753
super ().__init__ (entity = "deal" , last_modified_field = "hs_lastmodifieddate" , ** kwargs )
765
754
self ._stage_history = DealStageHistoryStream (** kwargs )
766
755
767
- def list (self , fields ) -> Iterable :
756
+ def list_records (self , fields ) -> Iterable :
768
757
history_by_id = {}
769
- for record in self ._stage_history .list (fields ):
758
+ for record in self ._stage_history .list_records (fields ):
770
759
if all (field in record for field in ("id" , "dealstage" )):
771
760
history_by_id [record ["id" ]] = record ["dealstage" ]
772
- for record in super ().list (fields ):
761
+ for record in super ().list_records (fields ):
773
762
if record .get ("id" ) and int (record ["id" ]) in history_by_id :
774
763
record ["dealstage" ] = history_by_id [int (record ["id" ])]
775
764
yield record
@@ -849,7 +838,7 @@ def read(self, getter: Callable, params: Mapping[str, Any] = None) -> Iterator:
849
838
if self .state :
850
839
params ['since' ] = self ._state
851
840
count = 0
852
- for record in self ._filter_dynamic_fields ( self . _filter_old_records (self ._read (getter , params ) )):
841
+ for record in self ._filter_old_records (self ._read (getter , params )):
853
842
yield record
854
843
count += 1
855
844
cursor = record [self .updated_at_field ]
0 commit comments