Skip to content

Commit

Permalink
Merge pull request #3870 from SFDO-Tooling/W-17621812/select_validations
Browse files Browse the repository at this point in the history
@W-17621812: Update _get_required_permission_types to handle SELECT operations
  • Loading branch information
aditya-balachander authored Jan 20, 2025
2 parents 1d90c46 + fe9173e commit e7d2917
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
5 changes: 4 additions & 1 deletion cumulusci/tasks/bulkdata/mapping_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ def _get_required_permission_types(
self, operation: DataOperationType
) -> T.Tuple[str]:
"""Return a tuple of the permission types required to execute an operation"""
if operation is DataOperationType.QUERY:
if (
operation is DataOperationType.QUERY
or self.action is DataOperationType.SELECT
):
return ("queryable",)
if (
operation is DataOperationType.INSERT
Expand Down
5 changes: 2 additions & 3 deletions cumulusci/tasks/bulkdata/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from contextlib import contextmanager
from itertools import tee
from typing import Any, Dict, List, NamedTuple, Optional, Union
from urllib.parse import quote

import requests
import salesforce_bulk
Expand Down Expand Up @@ -955,9 +956,7 @@ def _determine_limit_clause(self, total_num_records):
def _execute_soql_query(self, select_query, query_fields):
"""Executes the SOQL query and returns the flattened records."""
query_records = []
response = self.sf.restful(
requests.utils.requote_uri(f"query/?q={select_query}"), method="GET"
)
response = self.sf.restful(f"query/?q={quote(select_query)}", method="GET")
query_records.extend(self._flatten_response_records(response, query_fields))

while not response["done"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ interactions:

- request:
method: GET
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id,%20TYPEOF%20Who%20WHEN%20Contact%20THEN%20LastName,%20Email%20WHEN%20Lead%20THEN%20LastName,%20Company%20ELSE%20Id%20END,%20TYPEOF%20What%20WHEN%20Account%20THEN%20Name,%20Description,%20Phone,%20AccountNumber%20ELSE%20Id%20END,%20Subject,%20DurationInMinutes,%20ActivityDateTime%20FROM%20Event
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id%2C%20TYPEOF%20Who%20WHEN%20Contact%20THEN%20LastName%2C%20Email%20WHEN%20Lead%20THEN%20LastName%2C%20Company%20ELSE%20Id%20END%2C%20TYPEOF%20What%20WHEN%20Account%20THEN%20Name%2C%20Description%2C%20Phone%2C%20AccountNumber%20ELSE%20Id%20END%2C%20Subject%2C%20DurationInMinutes%2C%20ActivityDateTime%20FROM%20Event
body: null
headers: *id004
response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ interactions:

- request:
method: GET
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id,%20TYPEOF%20Who%20WHEN%20Contact%20THEN%20LastName,%20Email%20WHEN%20Lead%20THEN%20LastName,%20Company%20ELSE%20Id%20END,%20TYPEOF%20What%20WHEN%20Account%20THEN%20Name,%20Description,%20Phone,%20AccountNumber%20ELSE%20Id%20END,%20Subject,%20DurationInMinutes,%20ActivityDateTime%20FROM%20Event
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id%2C%20TYPEOF%20Who%20WHEN%20Contact%20THEN%20LastName%2C%20Email%20WHEN%20Lead%20THEN%20LastName%2C%20Company%20ELSE%20Id%20END%2C%20TYPEOF%20What%20WHEN%20Account%20THEN%20Name%2C%20Description%2C%20Phone%2C%20AccountNumber%20ELSE%20Id%20END%2C%20Subject%2C%20DurationInMinutes%2C%20ActivityDateTime%20FROM%20Event
body: null
headers: *id004
response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interactions:

- request:
method: GET
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id,%20Name,%20Description,%20Phone,%20AccountNumber%20FROM%20Account
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id%2C%20Name%2C%20Description%2C%20Phone%2C%20AccountNumber%20FROM%20Account
body: null
headers: *id004
response:
Expand Down

0 comments on commit e7d2917

Please sign in to comment.