Add ability to query using Composite Batch Api#114
Open
stevenskim wants to merge 1 commit into
Open
Conversation
df60fd8 to
2334fc0
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
==========================================
+ Coverage 97.26% 97.35% +0.08%
==========================================
Files 24 25 +1
Lines 951 982 +31
==========================================
+ Hits 925 956 +31
Misses 26 26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Automatically routes SOQL queries through the Salesforce Composite Batch API when the query length exceeds a configurable threshold, bypassing URL/header size limits on standard GET requests (~16,000–20,000 characters). The Composite Batch API supports the full SOQL length limit of 100,000 characters.
Changes
ActiveForce.composite_batch_query_threshold— New configurable threshold (default:100_000). The default matches the SOQL max length, effectively disabling composite batch routing unless explicitly lowered. Accepts an integer or a callable (proc/lambda) for dynamic evaluation (e.g., feature flags).ActiveQuery#result— Routes toCompositeBatchQuerywhen SOQL length ≥ threshold; otherwise uses the existingsfdc_client.query.CompositeBatchQuery— New class that executes SOQL viaRestforce#batch. Raises typedRestforce::ErrorCodeexceptions for error responses (status ≥ 300).Usage
Tests
spec/active_force/composite_batch_query_spec.rb— Covers successful queries, error handling, and client delegation.spec/active_force/active_query_spec.rb— Covers routing logic based on threshold.spec/active_force_spec.rb— Covers threshold configuration (default, static, callable).