Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'type' when loading data from tap-salesforce #357

Open
jaceksan opened this issue Mar 6, 2023 · 1 comment · May be fixed by #358
Open

KeyError: 'type' when loading data from tap-salesforce #357

jaceksan opened this issue Mar 6, 2023 · 1 comment · May be fixed by #358
Labels
bug Something isn't working

Comments

@jaceksan
Copy link

jaceksan commented Mar 6, 2023

Describe the bug
target-snowflake fails with KeyError: 'type' if loading data coming from tap-salesforce.
It does not happen always - the data structures from Salesforce must contain some pattern, not sure which one.

To Reproduce
Not sure, what data from Salesforce causes the issue. It does not fail with my development sandbox env, but it happens with my production Salesforce environment.

Expected behavior
target does not fail.

Screenshots
Example Meltano log:

2023-03-03T23:05:50.416866Z [info     ] INFO METRIC: {"type": "timer", "metric": "http_request_duration", "value": 0.12344241142272949, "tags": {"endpoint": "batch_result_list", "sobject": "Contact", "status": "succeeded"}} cmd_type=elb consumer=False name=tap-salesforce producer=True stdio=stderr string_id=tap-salesforce
2023-03-03T23:05:50.418542Z [info     ] INFO Making GET request to https://gooddata.my.salesforce.com/services/async/53.0/job/7506R00000dQHFBQA4/batch/7516R00000panqmQAA/result/7526R00000S2vi7 with params: None cmd_type=elb consumer=False name=tap-salesforce producer=True stdio=stderr string_id=tap-salesforce
2023-03-03T23:05:52.104308Z [info     ] INFO METRIC: {"type": "counter", "metric": "record_count", "value": 1, "tags": {"endpoint": "LeadHistory"}} cmd_type=elb consumer=False name=tap-salesforce producer=True stdio=stderr string_id=tap-salesforce
2023-03-03T23:05:52.109644Z [info     ] Traceback (most recent call last): cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.109913Z [info     ]   File "/home/jacek/work/src/panther-internal-analytics/data_pipeline/.meltano/loaders/target-snowflake/venv/bin/target-snowflake", line 8, in <module> cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.110175Z [info     ]     sys.exit(main())           cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.110322Z [info     ]   File "/home/jacek/work/src/panther-internal-analytics/data_pipeline/.meltano/loaders/target-snowflake/venv/lib/python3.10/site-packages/target_snowflake/__init__.py", line 526, in main cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.110446Z [info     ]     persist_lines(config, singer_messages, table_cache, file_format_type) cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.110604Z [info     ]   File "/home/jacek/work/src/panther-internal-analytics/data_pipeline/.meltano/loaders/target-snowflake/venv/lib/python3.10/site-packages/target_snowflake/__init__.py", line 143, in persist_lines cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.110725Z [info     ]     stream_utils.adjust_timestamps_in_record(o['record'], schemas[stream]) cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.110852Z [info     ]   File "/home/jacek/work/src/panther-internal-analytics/data_pipeline/.meltano/loaders/target-snowflake/venv/lib/python3.10/site-packages/target_snowflake/stream_utils.py", line 69, in adjust_timestamps_in_record cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.110973Z [info     ]     if 'string' in schema['properties'][key]['type'] and \ cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.111089Z [info     ] KeyError: 'type'               cmd_type=elb consumer=True name=target-snowflake-sfdc producer=False stdio=stderr string_id=target-snowflake-sfdc
2023-03-03T23:05:52.401696Z [error    ]                                

Your environment

  • Version of target: latest
  • Version of python 3.10

Additional context
N/A

@jaceksan jaceksan added the bug Something isn't working label Mar 6, 2023
jaceksan added a commit to jaceksan/pipelinewise-target-snowflake that referenced this issue Mar 6, 2023
@tjvananne
Copy link

tjvananne commented Dec 5, 2023

Adding some more context:

I believe this issue is independent of the tap being used, as I'm experiencing this issue while using tap-postgres.
I'm experiencing this issue when using the meltanolabs variant of tap-postgres. It isn't an issue when using the transferwise variant of tap-postgres.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants