https://meltano.com/ logo
#announcements
Title
# announcements
p

proud-pillow-55935

03/25/2021, 2:42 PM
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.
s

salmon-salesclerk-77709

03/25/2021, 2:43 PM
hello!
p

proud-pillow-55935

03/25/2021, 2:44 PM
Lol hit enter by mistake 😆
s

salmon-salesclerk-77709

03/25/2021, 2:46 PM
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?
p

proud-pillow-55935

03/25/2021, 3:05 PM
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?
s

salmon-salesclerk-77709

03/25/2021, 3:31 PM
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. @ripe-musician-59933 can you chime in?
Or @salmon-actor-23953 since Douwe is out for the next hour or so
s

salmon-actor-23953

03/25/2021, 3:39 PM
Hi, @proud-pillow-55935 - 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?
r

ripe-musician-59933

03/25/2021, 6:17 PM
@proud-pillow-55935 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>"}'
👍 2
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.
👍 1