Module: SfCli::Sf::Data::Query
- Included in:
- Core
- Defined in:
- lib/sf_cli/sf/data/query.rb,
lib/sf_cli/sf/data/query_helper.rb
Defined Under Namespace
Classes: BulkResultAdjuster, RawOutputResultAdjuster, RegularResultAdjuster
Instance Method Summary collapse
-
#query(soql, target_org: nil, format: nil, bulk: false, wait: nil, api_version: nil, model_class: nil) ⇒ Array, [String,Array]
Get object records using SOQL.
-
#query_resume(job_id:, target_org: nil, format: nil, api_version: nil, model_class: nil) ⇒ Array, [String,Array]
Resume a bulk query job, which you previously started, and get records.
Instance Method Details
#query(soql, target_org: nil, format: nil, bulk: false, wait: nil, api_version: nil, model_class: nil) ⇒ Array, [String,Array]
Get object records using SOQL. When using Bulk API, you get the records when the query job completes within time limit. The method returns a tapple(an array), which changes its contents according to the job result.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/sf_cli/sf/data/query.rb', line 42 def query(soql, target_org: nil, format: nil, bulk: false, wait: nil, api_version: nil, model_class: nil) flags = { :"query" => %("#{soql}"), :"target-org" => target_org, :"result-format" => format, :"wait" => (bulk ? wait : nil), :"api-version" => api_version, } switches = { bulk: bulk, } raw_output = format ? true : false format = format&.to_sym || :json result = exec(__method__, flags: flags, switches: switches, redirection: :null_stderr, raw_output: raw_output, format: format) return_result(result, raw_output, bulk, model_class) end |
#query_resume(job_id:, target_org: nil, format: nil, api_version: nil, model_class: nil) ⇒ Array, [String,Array]
Resume a bulk query job, which you previously started, and get records
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/sf_cli/sf/data/query.rb', line 86 def query_resume(job_id:, target_org: nil, format: nil, api_version: nil, model_class: nil) flags = { :"bulk-query-id" => job_id, :"target-org" => target_org, :"result-format" => format, :"api-version" => api_version, } raw_output = format ? true : false format = format || :json action = __method__.to_s.tr('_', ' ') result = exec(action, flags: flags, redirection: :null_stderr, raw_output: raw_output, format: format) return_result(result, raw_output, true, model_class) end |