SFDO-Tooling / CumulusCI

Python framework for building portable automation for Salesforce projects
http://cumulusci.readthedocs.io
BSD 3-Clause "New" or "Revised" License
363 stars 242 forks source link

is_person_type error when running snowfakery #3738

Closed tcdahlberg closed 9 months ago

tcdahlberg commented 9 months ago

Describe the bug

After upgrading to the recent version of cci (3.84.0) I get an error when running my snowfakery recipe that previously ran. I get this error:

Error: is_person_type

Which I am guessing may be a shift to a person account model.

Reproduction steps

  1. Add an EDA dependency to cumulus.yml
    dependencies:
    - github: 'https://github.com/SalesforceFoundation/EDA'
  2. Add this task to cumulus.yml
    create_fake_school_data:
    description: Makes fake account data to mimic schools with Educaiton as industry
    class_path: cumulusci.tasks.bulkdata.snowfakery.Snowfakery
    options:
      recipe: datasets/snowfakery/fake_schools.yml
  3. Add the dataset recipe
    
    - object: Account
    count: 1000
    fields:
    Name:
      random_choice:
        - choice:
            probability: 25%
            pick: ${{fake.last_name}} University
        - choice:
            probability: 25%
            pick: ${{fake.city}} University
        - choice:
            probability: 25%
            pick: ${{fake.last_name}} College
        - choice:
            probability: 25%
            pick: ${{fake.city}} College
    BillingCity:
      fake: city
    BillingStreet:
      fake: street_address
    BillingState:
      fake: State
    BillingCountry:
      fake: CurrentCountry
    Industry: Education
    Type: College
    RecordType: Educational_Institution
    - object: Account
    count: 1000
    fields:
    Name:
      random_choice:
        - choice:
            probability: 25%
            pick: ${{fake.last_name}} High School
        - choice:
            probability: 25%
            pick: ${{fake.city}} High School
        - choice:
            probability: 25%
            pick: ${{fake.last_name}} Senior High
        - choice:
            probability: 25%
            pick: ${{fake.city}} Senior High
    BillingCity:
      fake: city
    BillingStreet:
      fake: street_address
    BillingState:
      fake: State
    BillingCountry:
      fake: CurrentCountry
    Industry: Education
    Type: High School
    RecordType: Educational_Institution
4. Run the task after the scratch org builds

cci task info snowfakery



### Your CumulusCI and Python versions

CumulusCI version: 3.84.0 
Python version: 3.10.2

### Operating System

WIndows 11

### Windows environment

PowerShell

### CumulusCI installation method

pipx

### Error Gist

_No response_

### Additional information

_No response_
tcdahlberg commented 9 months ago

I built a clean cci project with the error in this repo: https://github.com/tcdahlberg/cci_is_person_type_error

Note: The error does not happen if EDA is not a dependency, so perhaps it is on the EDA side? I will try to investigate that angle.

If you run without the EDA dependency you will have to comment out the RecordType: Education_Institution in the snowfakery recipe.

I also commented out Account_Integration_External_ID__c: ${{id}} in the snofakery recipe because that was a field on the project I was working on.

When running a build with the debug flag I get this error:

Traceback (most recent call last):
  File "C:\Users\Big-Top\.local\pipx\venvs\cumulusci\lib\site-packages\sqlalchemy\sql\base.py", line 1223, in __getattr__
    return self._index[key]
KeyError: 'is_person_type'
rlilov commented 9 months ago

I am facing the same error : is_person_type (with 3.84) and my project does not use EDA at all. I think error is raised every time you load sample data with object that has a record type and target org is not having person accounts enabled.

I think issue is around here https://github.com/SFDO-Tooling/CumulusCI/blob/cbb223ec4691cbafe91501c020eaf5e1532388f8/cumulusci/tasks/bulkdata/query_transformers.py#L137

tcdahlberg commented 9 months ago

@rlilov , I think you are right. I am running into the error now when loading regular datasets (not snowfakery) now.

yippie commented 9 months ago

This error started happening starting with 3.84. Our scratch orgs DO have person accounts enabled and do NOT have EDA at all, it is a completely custom build.

yippie commented 9 months ago

Oh, I just realized, my org I am importing into was not created by CumulusCI, it is an imported org using cci org import this means the self.org_config.is_person_accounts_enabled may not be accurate? It does look like it is supposed to be checking the org though.

yippie commented 9 months ago

There is a fix already, looks like it is related to older load files https://github.com/SFDO-Tooling/CumulusCI/pull/3739

jstvz commented 9 months ago

@tcdahlberg Thanks for the report. Fixed in #3739.