hey folks, im looking to make two connections to h...
# getting-started
k
hey folks, im looking to make two connections to hellobaton each with a different instance. How would this work in meltano? Would i define another extractor? I also have
TAP_HELLOBATON_COMPANY
and
TAP_HELLOBATON_API_KEY
in my
.env
file for my current baton instance. How would it work for two since ill have a different api key and company?
currently i have:
Copy code
plugins:
  extractors:
  - name: tap-hellobaton
    schema:
      project_attachments:
        created_by:
          type: ["string", "null"]
      time_entries:
        created_by:
          type: ["string", "null"]
        user:
          type: ["string", "null"]
      project_users:
        user:
          type: ["string", "null"]
    namespace: tap_hellobaton
    pip_url: git+<https://github.com/dluftspring/tap-hellobaton.git>
    executable: tap-hellobaton
    capabilities:
    - catalog
    - state
    - discover
    settings:
    - name: company
      kind: string
    - name: api_key
      kind: password
    - name: user_agent
      kind: string
    config:
      company: lane
      user_agent: Singer Tap for hellobaton
    load_schema: hellobaton
in my
meltano.yml
. Doesnt look like there is a parameter to define which api key to use. Thats where i am a bit confused. If i add another extractor , how do i tell it to point to the other api key? Also, how would i define the api key in my env file since its the same connector
e
Hey @kevin! You could use inheritance to have multiple instances of the same plugin that you can configure with different variables in the same
.env
file. Meltano will use the plugin name, which will be different for each instance of the plugin, to generate the expected variable names. You can check those with
Copy code
meltano config tap-hellobaton list
meltano config tap-hellobaton--inherited list
k
Thanks @edgar_ramirez_mondragon! will take a look a report back
one QQ , when you say different variables in the same .env, from baton tap docs it says i have to define
TAP_HELLOBATON_API_KEY
. How would i define the second api key? ie ``TAP_HELLOBATON_API_KEY_2` ? looks like it needs to follow a convention
e
looks like it needs to follow a convention
Yes,
meltano config tap-hellobaton--inherited list
will show you the expected environment variable name. It should be something like
TAP_HELLOBATON__INHERITED_API_KEY
k
am getting this
Plugin 'tap-hellobaton--inherited' is not known to Meltano
any ideas?
e
Hi. Did you create an inherited plugin?
k
ah no i did not do that i was under the impression that there was a specific env variable that the second connection would look at
e
Yeah, the env var name is generated from the (inherited) plugin name, so you have to do this before:
Copy code
meltano add extractor tap-hellobaton--inherited --inherit-from tap-hellobaton
https://docs.meltano.com/reference/command-line-interface#add
k
cool! after that i can see now its
TAP_HELLOBATON__INHERITED_API_KEY
. So ill add that to my .env, created a file in my dags folder and then run
meltano elt tap-hellobaton--inherited target-snowflake --job_id=vts_baton-to-snowflake
?
e
Yes, though it’s not necessary to create a file in the dags folder to use
meltano elt
or
meltano run
k
awesome, i am getting this error when i run meltano elt
singer_sdk.exceptions.FatalAPIError: 401 Client Error: Unauthorized for path: /activity/
but i assume this is a credentials / api key problem rather then anything with meltano ?
Copy code
version: 1
send_anonymous_usage_stats: true
project_id: c817018d-de7b-45fb-9fff-260fa84ddaf9
plugins:
  extractors:
  - name: tap-hellobaton
    namespace: tap_hellobaton
    pip_url: git+<https://github.com/dluftspring/tap-hellobaton.git>
    executable: tap-hellobaton
    capabilities:
    - catalog
    - state
    - discover
    settings:
    - name: company
      kind: string
    - name: api_key
      kind: password
    - name: user_agent
      kind: string
    config:
      company: lane
      user_agent: Singer Tap for hellobaton
    schema:
      project_attachments:
        created_by:
          type: [string, 'null']
      time_entries:
        created_by:
          type: [string, 'null']
        user:
          type: [string, 'null']
      project_users:
        user:
          type: [string, 'null']
    load_schema: hellobaton
  - name: tap-hellobaton--inherited
    inherit_from: tap-hellobaton
    capabilities:
    - catalog
    - state
    - discover
    load_schema: vts-hellobaton