quantile-development / dagster-meltano

A Dagster plugin that allows you to run Meltano in Dagster
MIT License
41 stars 17 forks source link

feat(meltano): :sparkles: Inject environement variable for ops #20

Closed slamer59 closed 1 year ago

slamer59 commented 1 year ago

Closes #19 Use case : I want to be able to inject environment variable to change the meltano extraction.

This is a first proposal which works on my use case.

Defintion meltano.yaml in

plugins:
  extractors:
  - name: tap-rest-api-msdk
    variant: widen
    pip_url: tap-rest-api-msdk
    config:
      api_url: ...
      streams:
      - name: ...
        path: /...
      params:
        date_after: 01/01/2019
        date_before: 01/12/2019

I want to control date_after and date_before variable. With tap-rest-api-msdk we can setup TAP_REST_API_MSDK_PARAMS meltano command resumes to: TAP_REST_API_MSDK_PARAMS='{"date_after": "01/01/2022", "date_before":"01/12/2022"}' meltano run tap-rest-api-msdk target-jsonl

How I solve this:

Looks like this in UI where env is made optional: image

image

⚠️ In this exemple, meltano environment variable needs to be a string and should not be interpreted as a python object.

Any feedback is welcome.

JulesHuisman commented 1 year ago

@slamer59 Looks good! I like the simplicity, I will merge it into master.

slamer59 commented 1 year ago

@JulesHuisman Thanks for this velocity ;) I would have done the testing part :) later. Great :)