Hi all. So i’ve read through all the docs and run ...
# announcements
a
Hi all. So i’ve read through all the docs and run through some examples, but there’s one point i’m not really clear on. How do you create multiple pipelines using the same tap in your project? For example, if I wanted to extract from multiple different databases, or from multiple s3 sources?
d
@andrew_stewart Did you see https://meltano.com/docs/integration.html#pipeline-specific-configuration? There are also plans to support multiple configuration profiles at some point: https://gitlab.com/groups/meltano/-/epics/51
a
Yeah, I read that but it sounds like that’s just talking about overriding default config values? I assume that could be used for the purpose I described by way of orchestrators (multiple versions of the same DAG using different environment variables).
Do I have that about right?
d
Yes, that's currently the recommended method: to define configuration values you'll always want for a tap or target in
meltano.yml
, and to then specify pipeline-specific config values (to change the source S3 bucket or target database) at runtime using env vars.
"At runtime" here could also mean "in the orchestrator's DAG config"
If you're using
meltano schedule
, you can use the same
extractor
in multiple
schedules
entries, and specify pipeline-specific env vars using the
env
dictionary
a
Gotcha
d
With profiles (see link above), you'd be able to run
meltano elt tap-foo@profile-bar
,
meltano elt tap-foo@profile-baz
, etc, with those profiles each having their own
config
dict in
meltano.yml
, but for the moment env vars are the way to go
Would that work in your setup?
a
Well that will certainly nudge me towards using the orchestration feature.
Sure sure, I’m just trying to understand.
d
What are you currently using to manage the automatic running of your
meltano elt
pipelines?
a
Im curious to dig through that epic to see what thoughts there are regarding multiple profiles.
(Nothing, I haven’t graduated from tutorials/examples yet :) )
d
Ah, sure 🙂 Let me know if I can clarify anything. I expect to get to profiles some time in the next few months
a
Just to think out loud for benefit of feedback, I think from the perspective of a user used to platforms like Fivetran etc, I was expecting to see some kind of central config table of all my E->L variants, and that ‘meltano elt’ would somehow run through all of those.
The separation of concerns and utilization of orchestrators here makes total sense though, just maybe not intuitively at first.
d
With
meltano add orchestrator airflow
,
meltano schedule <pipeline>
,
meltano schedule list
, and
meltano invoke airflow scheduler
that's basically what you get! By the time we direct our focus specifically to less technical users who just want to use the UI, we can abstract that away even more and install and run the orchestrator automatically.
a
I wonder if multiple profile management could potentially be as simple as a config file that enumerates every tap/target config combination, which could potentially feed into (or inform) DAG generation.
d
What you're describing is exactly how our Airflow integration works 🙂
a
As well as potentially then having a variant of
meltano elt -all
or something similar
Gotcha
d
a config file that enumerates every tap/target config combination, which could potentially feed into (or inform) DAG generation.
That's https://gitlab.com/meltano/files-airflow/-/blob/master/bundle/orchestrate/dags/meltano.py
As well as potentially then having a variant of 
meltano elt -all
 or something similar
Currently, that's
meltano invoke airflow scheduler
, but we could have
meltano orchestrate
: https://gitlab.com/meltano/meltano/-/issues/2231
a
Ok so two more questions
d
Some of this orchestration stuff is definitely not as clear from the docs as it should be by the way, which I'll fix eventually: https://gitlab.com/meltano/meltano/-/issues/2260
a
1) where in the project can I currently represent those multiple profiles? Would this basically involve making copies of the DAG?
d
But with our current focus on data engineers who are already comfortable with orchestration and tools like Airflow, addressing that not been a priority yet
where in the project can I currently represent those multiple profiles?
https://meltano.com/docs/project.html#schedules
Would this basically involve making copies of the DAG?
No copying necessary, since that DAG generator already iterates over
meltano schedule list --format=json
a
2) you just answered with issue 2260
Cool
So sounds like all the ingredients are there, I just gotta better familiarize myself with the interoperations.
d
meltano schedule
schedules can also be managed using
meltano ui
Pipelines tab, by the way, but the UI does not automatically run the orchestrator
The
meltano add files docker-compose
file bundle starts both UI and scheduler, though: https://gitlab.com/meltano/files-docker-compose/-/blob/master/bundle/docker-compose.yml
a
Thanks for your patience with my newbie questions. I’m stoked to try this :)
d
So sounds like all the ingredients are there, I just gotta better familiarize myself with the interoperations.
And I've got to improve the docs 🙂 But yes, the ingredients are here, and it looks remarkably close to what you were brainstorming already!
With the current setup, it should be pretty easy to add support for different orchestrators, like Prefect.io, down the line as well, since we just need a different orchestrator-specific DAG(-equivalent) generator
a
I didnt really look yet, but are there any example repos setup that demonstrate more complicated configs?
d
Thanks for your patience with my newbie questions. I’m stoked to try this 🙂
Thanks for your feedback! It's really useful to hear what is and isn't obvious to newbies 😄
More complicated in what way?
a
as in beyond just a single tap/target
ie a ‘real world’ project
ok… so it looks like
job_id
from
meltano elt
is basically the construct I was looking for?
so you can create multiple pipeline variants via
meltano elt
calls w/ different variable overrides, and then register each ‘job’ with a schedule ?
d
ie a ‘real world’ project
https://gitlab.com/meltano/demo-project is not real, but it does have 2 schedules: https://gitlab.com/meltano/demo-project/-/blob/master/meltano.yml#L71
so you can create multiple pipeline variants via 
meltano elt
 calls w/ different variable overrides, and then register each ‘job’ with a schedule ?
Schedules are just a way of specifying how you would like
meltano elt
to be invoked (with specific arguments and environment variables), and when, which the orchestrator is then responsible for actually realizing. The schedule definition itself needs to specify the arguments and variable overrides, it doesn't look back at an earlier
meltano elt
run with the same job ID to find them. The job ID is only used to relate different
meltano elt
runs with each other for purposes of tracking incremental state.
I wouldn't have said myself that
meltano elt
"creates a pipeline variant", but it is a valid way of looking at it since it does register the job ID as something you may want to use later, when you run the same conceptual pipeline again.
a
Gotcha. I think what’s been hanging me up here is that
meltano elt
seems to both 1) register a pipeline and 2) run the pipeline (initial run).
d
@andrew_stewart The way I think about it, it runs a pipeline (whether it's the first or the last run, it doesn't matter, you'll always use
meltano elt
), and it allows you to specify a job ID to tag the state with. I get why you're interpreting that tagging as "registering the pipeline", though, since (unless you're using the default timestamped job ID) you are naming the pipeline for later reference. The pipeline won't exist in
meltano.yml
or
meltano schedule list
or Airflow until it's explicitly registered along with its arguments using
meltano schedule
, though, since running a pipeline once using
meltano elt
doesn't necessarily mean you want to run it again, even if a job ID was provided. Do you think this could more intuitive?
a
Maybe, but it’s also possible I’m being overly influenced by
dbt
where you configure/define the elements of your project and then
dbt run
the whole project.
d
The difference is that to Meltano, running
meltano elt
shouldn't be considered "running the project" or "defining a pipeline", but rather just "running a pipeline" as a one-off action without impact on the project. The fact that it "registers" the job ID should not be considered "defining an element of the project", since the state and job ID are stored in the system database, which is not considered part of the project since it's environment-specific and not version controlled. Actually defining the pipeline as an element of your project is done using
meltano schedule <name> ...
, which modifies
meltano.yml
and would usually be followed by a Git commit, unlike
meltano elt
, which doesn't touch the project at all.
a
Is a project intended to encapsulate a single extractor/loader combo ?
d
Of course, you don't need to register the pipeline as an element of your project to use Meltano, and it's perfectly valid to not use
meltano schedule
at all and just call
meltano elt
with the appropriate arguments directly from
BashOperator
(or its non-Airflow equivalent). For users already using Airflow or another orchestrator, treating
meltano elt
as just a CLI they can use to run Singer taps and targets may be more appropriate than to buy into Meltano's idea of explicitly defined pipelines that are expected to picked up by a DAG generator that reads from
meltano schedule list --format=json
, which is why
meltano elt
supports a job ID ("extractor state tag") that doesn't need to have been explicitly registered with the project before.
Is a project intended to encapsulate a single extractor/loader combo ?
Oh no, definitely not, the project is intended to encapsulate all of a team's ELT needs
With as many extractors and loaders, configuration profiles (soon!) and pipeline schedules as necessary
a
what do you think configuration profiles will look like ?
d
@andrew_stewart This part is already implemented actually, it's just not yet taken into account across the board, which that epic is meant to address. In
meltano.yml
, every plugin can have a
profiles
array, where each profile has a
name
, and its own
config
object:
Copy code
extractors:
  - name: tap-gitlab
    pip_url: git+<https://gitlab.com/meltano/tap-gitlab.git>
    config:
      projects: meltano/meltano
      start_date: '2020-05-01'
    profiles:
      - name: demo-project
        config:
          projects: meltano/demo-project
On
meltano config
,
meltano elt
, etc, you'd reference that specific profile as
tap-gitlab@demo-project
, e.g.
meltano elt tap-gitlab@demo-project target-snowflake@foo ...
a
ahaaaaa
d
The idea is that profile config inherits from the base (default) config, so the combined config for
tap-gitlab@demo-project
would be
{ projects: meltano/demo-project, start_date: '2020-05-01' }
a
Sure, that makes total sense.
d
I'm looking forward to being able to rewrite https://meltano.com/docs/integration.html#pipeline-specific-configuration with that feature in mind 😄
a
Right!
Do you envision adding some convenience command to run all profiles ?
(sort of like a very stripped down built-in orchestrator I guess)
d
I wouldn't be opposed to supporting an
--all
flag on the proposed
meltano schedule run
: https://gitlab.com/meltano/meltano/-/issues/2227
I'm not sure how much real-world value it'd have though, since you'd usually want to run specific ELT pipelines at different schedules, and in parallel
a
Right.. it’s funny because as I think about all the pieces together, it wouldn’t really make sense, but it sorta makes sense from a tutorial / sandbox purpose.
d
Right. Would you expect
meltano schedule run --all
to run pipelines in parallel, or serially? What if one pipeline fails? What would it log? (Especially if running in parallel!)
Anyway, feel free to suggest it on that issue 😄
But for the moment I'm assuming that people (or orchestrators!) will want to run one pipeline at a time 🙂
a
for a local run? probably just serially, and abort on fail.
Yeah the more I think about it the value is really only demonstrative.
d
Which is not to say that there isn't value in that 🙂 But it may also give people the wrong idea of how pipelines are usually run "in the real world", where serially and aborting on the first failure makes little sense
Unless one pipeline depends on another, of course
But that's not something Meltano currently has a concept of anyway
a
Yup. Well you’ve certainly made a very complex problem much simpler than it was.
d
Any feedback on how to make it simpler is appreciated of course 🙂 But some things are necessarily complex!
a
Thinking about it a bit more.. if there was really demand for some kind of single “task-naive” entrypoint (ike
dbt run
), I suppose what you could actually do is eventually have a
meltano run
command that fires up the docker-compose complete with the Meltano UI, orchestrator of choice, etc etc etc. Basically a ‘main switch’.
Unless one pipeline depends on another, of course
But that’s not something Meltano currently has a concept of anyway
That’s a really interesting idea, and I imagine already possible just through manipulating an existing DAG.
Hmm interesting…. you could potentially even manage the configuration of multi-step orchestrations via declarative workflows. ie..
meltano dependency [schedule1] [schedule2]
(or something like that). Examples of declarative DAGs in Airflow: • https://github.com/etsy/boundary-layer • https://medium.com/@nbrgil/airflow-with-yaml-dags-and-kubernetes-operator-ee9594b96714