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

bland-musician-68178

03/09/2021, 1:45 PM
Hi, I have a question about overriding data types. Is it possible to set the data type only with the environment variable without first using
meltano config <extractor> set _schema <entity> <attribute> <key> <value>
command? My env var
TAP_SPREADSHEETS_ANYWHERE__SCHEMA_LIST_OF_PRODUCTS_PRODUCT_NUMBER_TYPE=["string", "null"]
is only considered if I have the following schema section in `meltano.yml`:
Copy code
plugins:
  extractors:
  - name: tap-spreadsheets-anywhere
    namespace: tap_spreadsheets_anywhere
    pip_url: git+<https://github.com/ets/tap-spreadsheets-anywhere.git>
    capabilities:
    - catalog
    - discover
    - state
    schema:
      list_of_products:
        product_number:
          type:
          - string
          - 'null'
I have my
meltano.yml
in the Docker container. I do not change this configuration file, ELT contex (data source, data target) is set using env vars. However I didn't find a way to set the data type using env var only. For now, I'm using the
schema_overrides
option (https://github.com/ets/tap-spreadsheets-anywhere#configurationway) in
TAP_SPREADSHEETS_ANYWHERE_TABLES
env var, but this is a way to set the data type to tap-spreadsheets-anywhere only. It is not a universal solution.
r

ripe-musician-59933

03/09/2021, 3:37 PM
@bland-musician-68178 What you've found is correct: it's not currently possible to set a setting using an env var until Meltano knows about that particular setting because of it being defined in
meltano.yml
. This is because Meltano only defines the top-level
_schema
extra (with
<TAP>__SCHEMA
), and doesn't know about any of the nested settings until they're defined as custom settings and get an env var: https://meltano.com/docs/configuration.html#custom-settings Meltano doesn't currently parse the "original" schema from the catalog to proactively detect the nested settings and determine their env vars, nor does it eagerly read from the environment and attempt to parse
TAP_SPREADSHEETS_ANYWHERE__SCHEMA_LIST_OF_PRODUCTS_PRODUCT_NUMBER_TYPE
into
_schema.list_of_products.product_number.type
, since it's impossible to know just from that string which underscores represent nesting, and which represent actual underscores.
What's the use case where you'd like to be able to change a type using an env var, where it's not possible (or otherwise undesireable) to tell Meltano beforehand "this is the type I'm going to change using an env var later"?