Prithiv Vijai
06/13/2024, 3:59 PMReuben (Matatika)
06/13/2024, 4:27 PMReuben (Matatika)
06/13/2024, 4:30 PMPrithiv Vijai
06/13/2024, 6:14 PMReuben (Matatika)
06/13/2024, 6:21 PMReuben (Matatika)
06/13/2024, 6:23 PMPrithiv Vijai
06/13/2024, 6:23 PMPrithiv Vijai
06/13/2024, 6:24 PMReuben (Matatika)
06/13/2024, 6:25 PMPrithiv Vijai
06/13/2024, 6:26 PMPrithiv Vijai
06/13/2024, 6:30 PMReuben (Matatika)
06/13/2024, 6:43 PM/refService/getSubtypes
and dynamically build up SubtypesStream
in discover_streams
.Prithiv Vijai
06/13/2024, 7:01 PMReuben (Matatika)
06/13/2024, 7:31 PMclass Tapflexsod(Tap):
"""flexsod tap class."""
name = "tap-flexsod"
def discover_streams(self) -> List[Stream]:
"""Return a list of discovered streams."""
subtypes_stream = SubtypesStream(tap=self, schema={})
subtypes_records = subtypes_stream.get_records()
subtypes_stream.schema = th.PropertiesList(*[th.Property(f, th.StringType) for f in next(subtypes_records)]).to_dict()
return [subtypes_stream]
Of course this will make two requests to /refService/getSubtypes
so at that point you might as well stub out get_records
to return the records you already have.
def discover_streams(self) -> List[Stream]:
"""Return a list of discovered streams."""
subtypes_stream = SubtypesStream(tap=self, schema={})
subtypes_records = list(subtypes_stream.get_records())
subtypes_stream.schema = th.PropertiesList(*[th.Property(f, th.StringType) for f in subtypes_records[0]]).to_dict()
subtypes_stream.get_records = lambda _: iter(subtypes_records)
return [subtypes_stream]
Prithiv Vijai
06/14/2024, 2:41 PM