logstash-plugins/logstash-input-salesforce

Get several SFDC_OBJECT at one time.

Opened this issue · 1 comments

Now we can get only one kind of SFDC_OBJECT using this plugin at one time.

private
def get_query()
query = ["SELECT",@sfdc_fields.join(','),
"FROM",@sfdc_object_name]
query << ["WHERE",@sfdc_filters] unless @sfdc_filters.empty?
query << "ORDER BY LastModifiedDate DESC" if @sfdc_fields.include?('LastModifiedDate')
query_str = query.flatten.join(" ")
@logger.debug? && @logger.debug("SFDC Query", :query => query_str)
return query_str
end

https://github.com/logstash-plugins/logstash-input-salesforce/blob/master/lib/logstash/inputs/salesforce.rb#L139

Dataloader (salesforce's tool) can get some data from some SFDC_OBJECT those data are joined and output.
Likewise, want to get several data from some SFDC_OBJECT at one time using salesforce plugin.

■FYR
SOQL query for extraction of Dataloader

"Select LastName, FirstName, Email, Phone, Owner.UserName, Owner.ID, Owner.Name From Lead"

This would be very useful - e.g. when reading the AsyncApexJob object, it has a field ApexClassId which is a relationship field referencing an ApexClass. The ApexClassId only gives us the technical Id of the class. To get to the name of the Apex class we need to navigate across the relationship and query the ApexClass.Name field. From the AsyncApexJob object this would mean a cross-object join in the projection: SELECT Id, ApexClass.Name FROM AsyncApexJob.

I tested that this is already supported by the Restforce query method. Only the setup of the query and processing of the query results in the logstash-input-salesforce plugin needs to be updated.