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

Fix Invalid Lookups of namespaced fields #3759

Merged
merged 2 commits into from
Mar 4, 2024
Merged

Fix Invalid Lookups of namespaced fields #3759

merged 2 commits into from
Mar 4, 2024

Conversation

aditya-balachander
Copy link
Contributor

@aditya-balachander aditya-balachander commented Mar 1, 2024

W-15157537

These modifications address the error reported in Issue #3752.

The issue stemmed from the fact that during loading, when namespaces were injected into the mapping, only the key of the lookups dictionary would be altered, not the lookup class itself. For instance, mapping.lookups would appear as follows:

{
    <namespace>__<field>__c: MappingLookup(..., name="<field>__c", ...)
}

In the _infer_and_validate_lookups function within mapping_parser.py, we validate whether the sObjects mentioned in the mapping file under the lookup field are indeed part of the referenceTo of that field. However, the problem arose from the utilization of the name attribute under MappingLookup instead of the key value.

Change: We've modified it to reference the name with the key value of mapping.lookups instead of accessing it within MappingLookup class. This way the name would be the field with the injected namespace

Fixes #3752

@jstvz jstvz changed the title Fixes Issue #3752 - Invalid Lookups Fix Invalid Lookups of namespaced fields Mar 4, 2024
@jstvz jstvz merged commit 2b3bdf5 into main Mar 4, 2024
21 of 23 checks passed
@jstvz jstvz deleted the bug/invalid_lookup branch March 4, 2024 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid Lookup Error in Snowfakery Recipes
2 participants