avishua_stein
03/31/2023, 7:52 PMmeltano.yml
under the tap config:
config:
venues:
- name: brooklyn_steel
venue_id: KovZ917AC-V
- name: music_hall_of_williamsburg
venue_id: KovZpZA77eIA
- name: terminal_5
venue_id: KovZpZAFkn6A
- name: webster_hall
venue_id: KovZpa6WFe
- name: irving_plaza
venue_id: KovZpaFPje
- name: mercury_lounge
venue_id: KovZpZAJAkAA
- name: gramercy_theatre
venue_id: KovZpZAEAdaA
- name: brooklyn_mirage
venue_id: KovZ917AINX
- name: sony_hall
venue_id: KovZ917Ah5Q
- name: elsewhere_brooklyn
venue_id: KovZpZA6enaA
In discover_streams
I'm trying to instantiate the stream multiple times:
def discover_streams(self) -> list[streams.TicketmasterStream]:
# ...
return [streams.ConcertStream(self, name) for name in self.config["venues"]]
And because I want the data from each venue to end up in the same output table, I'm hardcoding the name in the stream class:
class ConcertStream(TicketmasterStream):
"""Concert Stream."""
def __init__(
self,
tap: TapBaseClass,
venue: Dict[str, Any],
name: Optional[str] = None,
schema: Optional[Union[Dict[str, Any], Schema]] = None,
path: Optional[str] = None,
) -> None:
self.name = "concerts"
self.venue_name = venue["name"]
self.venue_id = venue["venue_id"]
self.path = "/events.json"
self.replication_key = None
But as a result, my stream only ends up running for the last venue in the tap config, in this case 'elsewhere_brooklyn'. What's the proper way to set this up so I can pull data for each specified venue and send the data to the same table output? I'd rather not have to union all
the tables downstream and instead just have each venue's events sent to an 'events' table.edgar_ramirez_mondragon
03/31/2023, 7:59 PMvenue_ids
config. Then initialize a partition for each venue ID. Similar to https://github.com/MeltanoLabs/tap-dbt/blob/e2aab53b1d2638c1fb02d364a39a8505c402b088/tap_dbt/streams.py#L44-L51avishua_stein
03/31/2023, 8:05 PMdef get_url_params(
self,
context: dict | None,
next_page_token: Any | None,
) -> dict[str, Any]:
# ...
params: dict = {}
if next_page_token:
params["page"] = next_page_token
params["size"] = 200
params["venueId"] = self.venue_id
return params
edgar_ramirez_mondragon
03/31/2023, 8:05 PMavishua_stein
03/31/2023, 8:34 PMedgar_ramirez_mondragon
03/31/2023, 8:35 PMavishua_stein
03/31/2023, 8:41 PMname
edgar_ramirez_mondragon
03/31/2023, 9:04 PMname
. Internally, the SDK uses that attribute to fill a dictionary of streams so it was discarding all other values.avishua_stein
04/24/2023, 7:08 PMedgar_ramirez_mondragon
04/24/2023, 8:00 PMmeltano.yml
using include_paths and declare the plugin there