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

Import mapping with "External-Id Relationship Fields" #83

Open
amureki opened this issue Oct 15, 2019 · 0 comments
Open

Import mapping with "External-Id Relationship Fields" #83

amureki opened this issue Oct 15, 2019 · 0 comments
Labels

Comments

@amureki
Copy link
Contributor

amureki commented Oct 15, 2019

Description

Imagine you have the structure in your code/Salesforce like:

# salesforce/models.py
class SalesforceRelatedObject(hc_models.HerokuConnectModel):
    sf_object_name = 'RelatedObject__c'
    backend_uuid = hc_models.ExternalID(sf_field_name='BackendUUID__c',)


class MySalesforceObject(hc_models.HerokuConnectModel):
    related_object_id = hc_models.ID(
            sf_field_name='RelatedObject__c', unique=False, db_index=True
    )
    related_object = hc_models.Lookup(
        'salesforce.SalesforceRelatedObject',
        sf_field_name='RelatedObject__r__BackendUUID__c',
        blank=True,
        on_delete=models.SET_NULL,
        to_field='backend_uuid',
    )

In this case, import mappings command will produce mapping that contains both fields, but it would not generate an index part of the mapping for RelatedObject__c. This is silently breaking the whole mapping and RelatedObject__r__BackendUUID__c won't be added.

To Do

  1. We need to add a validation to prevent this kind of failure. This could be done somewhere around heroku_connect.db.models.base.HerokuConnectModel.get_heroku_connect_field_mapping
  2. A ticket to Heroku asking why this silently breaks would be also good.
@amureki amureki added the bug label Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant