talles_lessa
09/25/2023, 3:22 PMstreams.py
import yaml
# Load the YAML config file from meltano
with open("meltano.yml", "r") as yaml_file:
cu_config = yaml.safe_load(yaml_file)
def extract_and_convert_list(config, key):
value = config.get(key, "")
if value:
split_values = value.split(',')
return [int(item) for item in split_values]
return []
def find_tap_clickup_config(plugins):
for plugin in plugins:
if plugin.get("name") == "tap-clickup":
return plugin.get("config", {})
return {}
# Find the tap-clickup configuration
tap_clickup_config = find_tap_clickup_config(cu_config["plugins"]["extractors"])
# Extract and convert workspace ID
cu_workspace = tap_clickup_config.get("workspace_id")
# Extract and convert spaces and lists
spaces_id_list = extract_and_convert_list(tap_clickup_config, "spaces_id")
lists_id_list = extract_and_convert_list(tap_clickup_config, "list_ids")
And here is the
meltano.yml
version: 1
default_environment: dev
project_id: 8f483ca8-e13c-4abb-8d24-45666666
environments:
- name: dev
- name: staging
- name: prod
config:
plugins:
extractors:
- name: tap-clickup
variant: autoidm
pip_url: tap-clickup
config:
flattening_enabled: true
flattening_max_depth: 3
workspace_id: 12345
spaces_id: '11111111,22222222'
list_ids: ''
select:
- space.name
- space.id
- task.*
loaders:
plugins:
extractors:
- name: tap-clickup
variant: autoidm
pip_url: tap-clickup
config:
flattening_enabled: true
flattening_max_depth: 3
workspace_id: 12345
spaces_id: '33333333,44444444'
list_ids: ''
select:
- space.name
- space.id
- task.*
visch
09/25/2023, 3:26 PMspace_ids
, workspace_ids
etc
Copy the code from here for the stream https://github.com/AutoIDM/tap-indeed/blob/main/tap_indeedsponsoredjobs/streams.py#L80-L87 (plopping in client.py
is probably the easiest way )talles_lessa
09/25/2023, 6:59 PMvisch
09/26/2023, 6:15 PM