Skip to content

Commit

Permalink
Merge branch 'main' into Issue3549
Browse files Browse the repository at this point in the history
  • Loading branch information
jtruit authored Jan 16, 2025
2 parents ff865af + 1225b76 commit 3979691
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 74 deletions.
2 changes: 1 addition & 1 deletion cumulusci/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.0.1.dev1"
__version__ = "4.1.0"
11 changes: 0 additions & 11 deletions cumulusci/tasks/bulkdata/select_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
from pydantic import Field, root_validator, validator

from cumulusci.core.enums import StrEnum
from cumulusci.tasks.bulkdata.extract_dataset_utils.hardcoded_default_declarations import (
DEFAULT_DECLARATIONS,
)
from cumulusci.tasks.bulkdata.utils import CaseInsensitiveDict
from cumulusci.utils import get_cci_upgrade_command
from cumulusci.utils.yaml.model_parser import CCIDictModel
Expand Down Expand Up @@ -188,10 +185,6 @@ def standard_generate_query(
filter_clause=user_filter, limit_clause=limit, offset_clause=offset
)
else:
# Get the WHERE clause from DEFAULT_DECLARATIONS if available
declaration = DEFAULT_DECLARATIONS.get(sobject)
if declaration:
query += f" WHERE {declaration.where}"
query += f" LIMIT {limit}" if limit else ""
query += f" OFFSET {offset}" if offset else ""
return query, ["Id"]
Expand Down Expand Up @@ -281,10 +274,6 @@ def similarity_generate_query(
filter_clause=user_filter, limit_clause=limit, offset_clause=offset
)
else:
# Get the WHERE clause from DEFAULT_DECLARATIONS if available
declaration = DEFAULT_DECLARATIONS.get(sobject)
if declaration:
query += f" WHERE {declaration.where}"
query += f" LIMIT {limit}" if limit else ""
query += f" OFFSET {offset}" if offset else ""

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%20WHERE%20Name%20!=%20'Sample%20Account%20for%20Entitlements'
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id,%20Name,%20Description,%20Phone,%20AccountNumber%20FROM%20Account
body: null
headers: *id004
response:
Expand Down Expand Up @@ -125,7 +125,7 @@ interactions:

- request:
method: GET
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id%20FROM%20Account%20WHERE%20Name%20!=%20'Sample%20Account%20for%20Entitlements'%20LIMIT%205
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id%20FROM%20Account%20LIMIT%205
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%20WHERE%20Name%20!=%20'Sample%20Account%20for%20Entitlements'
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id,%20Name,%20Description,%20Phone,%20AccountNumber%20FROM%20Account
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%20WHERE%20Name%20!=%20'Sample%20Account%20for%20Entitlements'
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id,%20Name,%20Description,%20Phone,%20AccountNumber%20FROM%20Account
body: null
headers: *id004
response:
Expand Down Expand Up @@ -125,7 +125,7 @@ interactions:

- request:
method: GET
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id%20FROM%20Account%20WHERE%20Name%20!=%20'Sample%20Account%20for%20Entitlements'%20LIMIT%205
uri: https://orgname.my.salesforce.com/services/data/v62.0/query/?q=SELECT%20Id%20FROM%20Account%20LIMIT%205
body: null
headers: *id004
response:
Expand Down
57 changes: 3 additions & 54 deletions cumulusci/tasks/bulkdata/tests/test_select_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,7 @@
PANDAS_AVAILABLE = False


# Test Cases for standard_generate_query
def test_standard_generate_query_with_default_record_declaration():
select_operator = SelectOperationExecutor(SelectStrategy.STANDARD)
sobject = "Account" # Assuming Account has a declaration in DEFAULT_DECLARATIONS
limit = 5
offset = 2
query, fields = select_operator.select_generate_query(
sobject=sobject, fields=[], user_filter="", limit=limit, offset=offset
)

assert "WHERE" in query # Ensure WHERE clause is included
assert f"LIMIT {limit}" in query
assert f"OFFSET {offset}" in query
assert fields == ["Id"]


def test_standard_generate_query_without_default_record_declaration():
def test_standard_generate_query_without_filter():
select_operator = SelectOperationExecutor(SelectStrategy.STANDARD)
sobject = "Contact" # Assuming no declaration for this object
limit = 3
Expand All @@ -49,7 +33,6 @@ def test_standard_generate_query_without_default_record_declaration():
sobject=sobject, fields=[], user_filter="", limit=limit, offset=offset
)

assert "WHERE" not in query # No WHERE clause should be present
assert f"LIMIT {limit}" in query
assert "OFFSET" not in query
assert fields == ["Id"]
Expand All @@ -72,23 +55,7 @@ def test_standard_generate_query_with_user_filter():
assert fields == ["Id"]


# Test Cases for random generate query
def test_random_generate_query_with_default_record_declaration():
select_operator = SelectOperationExecutor(SelectStrategy.RANDOM)
sobject = "Account" # Assuming Account has a declaration in DEFAULT_DECLARATIONS
limit = 5
offset = 2
query, fields = select_operator.select_generate_query(
sobject=sobject, fields=[], user_filter="", limit=limit, offset=offset
)

assert "WHERE" in query # Ensure WHERE clause is included
assert f"LIMIT {limit}" in query
assert f"OFFSET {offset}" in query
assert fields == ["Id"]


def test_random_generate_query_without_default_record_declaration():
def test_random_generate_query():
select_operator = SelectOperationExecutor(SelectStrategy.RANDOM)
sobject = "Contact" # Assuming no declaration for this object
limit = 3
Expand All @@ -97,7 +64,6 @@ def test_random_generate_query_without_default_record_declaration():
sobject=sobject, fields=[], user_filter="", limit=limit, offset=offset
)

assert "WHERE" not in query # No WHERE clause should be present
assert f"LIMIT {limit}" in query
assert "OFFSET" not in query
assert fields == ["Id"]
Expand Down Expand Up @@ -209,23 +175,7 @@ def test_random_post_process_with_no_records():
assert error_message == f"No records found for {sobject} in the target org."


# Test Cases for Similarity Generate Query
def test_similarity_generate_query_with_default_record_declaration():
select_operator = SelectOperationExecutor(SelectStrategy.SIMILARITY)
sobject = "Account" # Assuming Account has a declaration in DEFAULT_DECLARATIONS
limit = 5
offset = 2
query, fields = select_operator.select_generate_query(
sobject, ["Name"], [], limit, offset
)

assert "WHERE" in query # Ensure WHERE clause is included
assert fields == ["Id", "Name"]
assert f"LIMIT {limit}" in query
assert f"OFFSET {offset}" in query


def test_similarity_generate_query_without_default_record_declaration():
def test_similarity_generate_query_no_nesting():
select_operator = SelectOperationExecutor(SelectStrategy.SIMILARITY)
sobject = "Contact" # Assuming no declaration for this object
limit = 3
Expand All @@ -234,7 +184,6 @@ def test_similarity_generate_query_without_default_record_declaration():
sobject, ["Name"], [], limit, offset
)

assert "WHERE" not in query # No WHERE clause should be present
assert fields == ["Id", "Name"]
assert f"LIMIT {limit}" in query
assert "OFFSET" not in query
Expand Down
27 changes: 24 additions & 3 deletions docs/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,42 @@

<!-- latest-start -->

## v4.0.1.dev1 (2025-01-01)
## v4.1.0 (2025-01-09)

<!-- Release notes generated using configuration in .github/release.yml at main -->

## What's Changed

### Changes 🎉

- Remove default declaration for select rows query by [@mjawadtp](https://github.com/mjawadtp) in
[#3867](https://github.com/SFDO-Tooling/CumulusCI/pull/3867)
- @W-17427085: Set ANNOY related dependencies to be optional by [@aditya-balachander](https://github.com/aditya-balachander) in [#3858](https://github.com/SFDO-Tooling/CumulusCI/pull/3858)
- Update on the documentation for SFDX_ORG_CREATE_ARGS environment variable by [@lakshmi2506](https://github.com/lakshmi2506) in [#3861](https://github.com/SFDO-Tooling/CumulusCI/pull/3861)
- @W-16485311: Core Logic for Selecting Records from Target Org by [@aditya-balachander](https://github.com/aditya-balachander) in [#3818](https://github.com/SFDO-Tooling/CumulusCI/pull/3818)
- Add integration tests for all selection strategies by [@mjawadtp](https://github.com/mjawadtp) in [#3851](https://github.com/SFDO-Tooling/CumulusCI/pull/3851)
- @W-17357226: Fix for issue where zero threshold defaulted to select by [@aditya-balachander](https://github.com/aditya-balachander) in [#3853](https://github.com/SFDO-Tooling/CumulusCI/pull/3853)
- @W-17366392: Fix Omnistudio issues for the sf command format by [@lakshmi2506](https://github.com/lakshmi2506) in [#3855](https://github.com/SFDO-Tooling/CumulusCI/pull/3855)
- fix: restore task and flow reference docs by [@jstvz](https://github.com/jstvz) in [#3856](https://github.com/SFDO-Tooling/CumulusCI/pull/3856)
- @W-17412267: Fix for records not being inserted when threshold 0 by [@aditya-balachander](https://github.com/aditya-balachander) in [#3857](https://github.com/SFDO-Tooling/CumulusCI/pull/3857)

**Full Changelog**: https://github.com/SFDO-Tooling/CumulusCI/compare/v4.0.1.dev0...v4.0.1.dev1
**Full Changelog**: https://github.com/SFDO-Tooling/CumulusCI/compare/v4.0.1.dev1...v4.1.0

<!-- latest-stop -->

## v4.1.0.dev1 (2025-01-01)

<!-- Release notes generated using configuration in .github/release.yml at main -->

## What's Changed

### Changes 🎉

- @W-17427085: Set ANNOY related dependencies to be optional by [@aditya-balachander](https://github.com/aditya-balachander) in [#3858](https://github.com/SFDO-Tooling/CumulusCI/pull/3858)
- Update on the documentation for SFDX_ORG_CREATE_ARGS environment variable by [@lakshmi2506](https://github.com/lakshmi2506) in [#3861](https://github.com/SFDO-Tooling/CumulusCI/pull/3861)

**Full Changelog**: https://github.com/SFDO-Tooling/CumulusCI/compare/v4.0.1.dev0...v4.0.1.dev1

## v4.0.1.dev0 (2024-12-16)

<!-- Release notes generated using configuration in .github/release.yml at main -->
Expand All @@ -32,7 +53,7 @@
- fix: restore task and flow reference docs by [@jstvz](https://github.com/jstvz) in [#3856](https://github.com/SFDO-Tooling/CumulusCI/pull/3856)
- @W-17412267: Fix for records not being inserted when threshold 0 by [@aditya-balachander](https://github.com/aditya-balachander) in [#3857](https://github.com/SFDO-Tooling/CumulusCI/pull/3857)

**Full Changelog**: https://github.com/SFDO-Tooling/CumulusCI/compare/v4.0.1...v4.0.1.dev0
**Full Changelog**: https://github.com/SFDO-Tooling/CumulusCI/compare/v4.0.1...v4.1.0

## v4.0.1 (2024-11-18)

Expand Down

0 comments on commit 3979691

Please sign in to comment.