robby_robinson
11/30/2022, 1:04 AM/users
and it takes query parameters (eg: ?group={name}) and other endpoints that also take query parameters (eg /licenses?app={name}
), could a user of the tap specify a different query for each endpoint as a stream config? Or would I need to create a tap parameter for each stream so a user can pass it along in the query parameters?aaronsteers
11/30/2022, 1:08 AMrobby_robinson
11/30/2022, 3:00 AMaaronsteers
11/30/2022, 4:05 AM{
// Other tap-wide settings here ...
"stream_config": {
"stream_a": {
// These only apply to 'stream_a':
"additional_filters": [
{ "param": "app", "value": "my-app" }
]
}
}
Then, you can either let the tap resolve these config overrides during discovery and send them only to the Stream classes that need them, or (probably easier) just use the default behavior at the tap level (every stream gets the whole config object) and let streams check for overrides that match their own name at runtime, for instance when responding get_url_params().
Does this help?robby_robinson
11/30/2022, 5:51 PMrobby_robinson
12/01/2022, 5:14 PMrobby_robinson
12/01/2022, 7:08 PMth.Property(
'stream_config',
th.ArrayType(
th.PropertiesList(
th.Property(
'stream',
th.StringType,
description='Name of stream to apply config.'
),
th.Property(
'params',
th.ArrayType(
th.PropertiesList(
th.Property(
'param',
th.StringType,
description='Name of query parameter.'
),
th.Property(
'value',
th.StringType,
description='Value of query parameter.'
)
)
)
)
)
),
description='Custom config for stream.'
# client.py
def get_url_params(
self, context: Optional[dict], next_page_token: Optional[Any]
) -> Dict[str, Any]:
stream_config = self.config.get('stream_config')
if stream_config:
params = [c.get('params') for c in stream_config if c.get('stream') == self.name]
if params:
return {p.get('param'):p.get('value') for p in params[-1]}
robby_robinson
12/01/2022, 7:14 PM"stream_config": [
{
"stream": "users",
"params": [
{"param": "$count", "value": "true"},
{"param": "$select", "value": "id,mail"}
]
}
]
aaronsteers
12/01/2022, 8:40 PM