Content-Length: 257082 | pFad | https://github.com/simple-salesforce/simple-salesforce/pull/740

65 Fix bulk2 upsert example by y-ken · Pull Request #740 · simple-salesforce/simple-salesforce · GitHub
Skip to content

Fix bulk2 upsert example #740

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

Merged
merged 2 commits into from
Jul 18, 2024
Merged

Conversation

y-ken
Copy link

@y-ken y-ken commented Jun 27, 2024

Hi, I have noticed non-working example in README.

>>> sf.bulk2.Service__c.upsert("./user_stat.csv", 'Account_Id__c')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/y-ken/miniforge3/lib/python3.10/site-packages/simple_salesforce/bulk2.py", line 1011, in upsert
    records=_convert_dict_to_csv(
  File "/Users/y-ken/miniforge3/lib/python3.10/site-packages/simple_salesforce/bulk2.py", line 234, in _convert_dict_to_csv
    keys = set(i for s in [d.keys() for d in data] for i in s)
  File "/Users/y-ken/miniforge3/lib/python3.10/site-packages/simple_salesforce/bulk2.py", line 234, in <listcomp>
    keys = set(i for s in [d.keys() for d in data] for i in s)
AttributeError: 'str' object has no attribute 'keys'

I have proposed suggestion that it works.

this is based on the actual implementation. and I have also checked with my local environment.

def upsert(
self,
csv_file: Optional[str] = None,
records: Optional[List[Dict[str, str]]] = None,
external_id_field: str = 'Id',
batch_size: Optional[int] = None,
column_delimiter: ColumnDelimiter = ColumnDelimiter.COMMA,
line_ending: LineEnding = LineEnding.LF,
wait: int = 5,
) -> List[Dict[str, int]]:

@jon-wobken jon-wobken changed the base branch from master to release/v1.12.7 July 18, 2024 20:17
@jon-wobken jon-wobken merged commit 9b825c6 into simple-salesforce:release/v1.12.7 Jul 18, 2024
1 check failed
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.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/simple-salesforce/simple-salesforce/pull/740

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy