rahul_anand
07/14/2020, 7:34 PM- name: tap-exchangeratesapi
namespace: tap_exchangeratesapi
pip_url: tap-exchangeratesapi
executable: tap-exchangeratesapi
config:
start_date: '${EXCHANGE_START_DATE}'
First run:
EXCHANGE_START_DATE='2020-07-13' meltano elt tap-exchangeratesapi target-csv --job_id=extract_rates
Subsequent run:
meltano elt tap-exchangeratesapi target-csv --job_id=extract_rates
Log output:
Variable EXCHANGE_START_DATE is missing from the environment.
Variable EXCHANGE_START_DATE is missing from the environment.
Running extract & load...
Variable EXCHANGE_START_DATE is missing from the environment.
Variable EXCHANGE_START_DATE is missing from the environment.
Found state from 2020-07-14 19:25:28.973045.
INFO Replicating exchange rate data from 2020-07-14 using base USD
INFO Tap exiting normally
Incremental state has been updated at 2020-07-14 19:26:15.840289.
Extract & load complete!
Transformation skipped.
If I pass the EXCHANGE_START_DATE the tap starts from the passed date ignoring the state. How can I silent these noise around missing variables?douwe_maan
07/14/2020, 7:48 PMstart_date setting when state is provided, and tap-exchangeratesapi does so as well: https://github.com/singer-io/tap-exchangeratesapi/blob/master/tap_exchangeratesapi/__init__.py#L112douwe_maan
07/14/2020, 7:49 PMstart_date setting should not be a problem, since it will (should) only be used on the first run.
Is there a specific reason you're referencing an env var in the setting value, instead of hard-coding it?douwe_maan
07/14/2020, 7:50 PMstart_date setting like any other, including warning "Variable is missing from the environment" when env var expansion failed and the value falls back on None because of it.
The start_date setting (like any other setting) only has special meaning to the tap itself.rahul_anand
07/14/2020, 7:52 PMEXCHANGE_START_DATE=2020-07-13 meltano elt tap-exchangeratesapi target-csv --job_id=extract_rates
Overrides the state and the tap starts re-downloading from ' 2020-07-13'.rahul_anand
07/14/2020, 7:52 PMdouwe_maan
07/14/2020, 7:53 PMexchangesratesapi appears to do so correctly (https://github.com/singer-io/tap-exchangeratesapi/blob/master/tap_exchangeratesapi/__init__.py#L112), so I think we'll want to debug why that's not actually behaving as the code would suggestdouwe_maan
07/14/2020, 7:53 PMstart_date key?douwe_maan
07/14/2020, 7:54 PMstate = {'start_date': next_date}rahul_anand
07/14/2020, 7:59 PM{"singer_state": {"start_date": "2020-07-14"}}douwe_maan
07/14/2020, 8:01 PM.meltano/extractors/tap-exchangeratesapi/venv/lib/python3.7/site-packages/tap-exchangeratesapi/tap_exchangeratesapi/__init__.py and add some print-based debugging around the line at https://github.com/singer-io/tap-exchangeratesapi/blob/master/tap_exchangeratesapi/__init__.py#L112, so that we can see whether it's reading the state correctly, and why it's still preferring the config over the state?rahul_anand
07/14/2020, 8:02 PM--state without overriding the value and the --config as usual. The tap needs to honor the state and disregard the value from --config .douwe_maan
07/14/2020, 8:03 PMconfig.json, regardless of state, and it's up to the tap to prefer state over configured start_datedouwe_maan
07/14/2020, 8:03 PMmeltano.yml config value or notrahul_anand
07/14/2020, 8:03 PMdouwe_maan
07/14/2020, 8:04 PMmeltano --log-level=debug elt ...douwe_maan
07/14/2020, 8:05 PMrahul_anand
07/14/2020, 8:20 PM<http://logger.info|logger.info>(f'state: {state}')
<http://logger.info|logger.info>(f'config: {config}')
Log output:
INFO state: {}
INFO config: {'start_date': '2020-07-13'}
In system database I see the state:
41|extract_rates|SUCCESS|2020-07-14 20:17:09.885764|2020-07-14 20:17:14.440576|{"singer_state": {"start_date": "2020-07-14"}}|1|c473429584834c5f9f501682293ba530|clidouwe_maan
07/14/2020, 8:22 PMEXCHANGE_START_DATE , is any state logged then?douwe_maan
07/14/2020, 8:22 PM--state flag in the meltano --log-level=debug elt ... invocation logs?douwe_maan
07/14/2020, 8:22 PMstate under the custom plugin definition's capabilities ?rahul_anand
07/14/2020, 8:24 PMdouwe_maan
07/14/2020, 8:25 PMdouwe_maan
07/14/2020, 8:25 PMdatetime.utcnow().strftime(DATE_FORMAT)rahul_anand
07/14/2020, 8:25 PMINFO state: {}
INFO config: {'start_date': None}douwe_maan
07/14/2020, 8:25 PMdouwe_maan
07/14/2020, 8:25 PMdouwe_maan
07/14/2020, 8:27 PMrahul_anand
07/14/2020, 8:29 PMstate under capabilities resolved the issue.douwe_maan
07/14/2020, 8:29 PMdouwe_maan
07/14/2020, 8:29 PMrahul_anand
07/14/2020, 8:30 PMdouwe_maan
07/14/2020, 8:30 PMrahul_anand
07/14/2020, 8:44 PM