Hello my good Meltano community! I'm trying to se...
# announcements
r
Hello my good Meltano community! I'm trying to set multiple schema definitions via environment variables. How would I structure the
<EXTRACTOR>__SCHEMA
variable to include multiple different streams with different column definitions? I'm looking specifically at this documentation.
t
hello!
r
Lol hit enter by mistake 😆
t
Copy code
export <EXTRACTOR>__SCHEMA_<ENTITY>_<ATTRIBUTE>_<KEY>=<value>
seems to be the answer but, full disclosure, I’ve never done this. do you have the different stream definitions?
r
It said this right above that:
Copy code
# Once schema descriptions have been set in `meltano.yml`, environment variables can be used
# to override specific nested properties:
So it sounds like I need to define the schema in
meltano.yml
before I use that?
t
oh that’s in the code block. hmm, I don’t know the answer then. My gut would say that you could just set the environment variable and that would work (that’s what would make sense to me) but that text there seems to indicate otherwise. @douwe_maan can you chime in?
Or @aaronsteers since Douwe is out for the next hour or so
a
Hi, @ricky_renner - just to confirm, did you want to set up two instances of the extractor, with one inheriting from the other, or did you want a single instance that can target two different schemas depending on the env vars when run?
Based on your original comment, I think you want the inherits-from behavior, which basically makes two extractor definitions, one inheriting from the other, but each can have their own selection logic and their own variable overrides. Does that sound right?
d
@ricky_renner So you want to set the entire schema for a tap and its multiple streams using a single env var? You're on the right track with
TAP_FOO__SCHEMA
, which you'll want to set it to a JSON-encoded dictionary with a top-level key for each stream. If you want to use a separate env var for each stream, you'll first have to add a key for each stream to
meltano.yml
, which can look like this:
Copy code
schema:
  stream_one: {}
  stream_two: {}
You can then use
TAP_FOO__SCHEMA_STREAM_ONE='{"<attribute>": {"<key>": "<value>"}'
However, it'll be easiest to maintain if you just set the entire schema in
meltano.yml
instead of injecting it at runtime using the environment
As AJ said, if you want to use the same tap with different schema settings, you can use inheritance.