Mule Salesforce connector in query operation. List of Maps as input - salesforce

I have a huge list of Ids and Names for Contacts defined in this simple DW script. Let's show just two for simplicity:
[
{id:'169057',Name:'John'},
{id:'169099',Name:'Mark'}
]
I need salesforce connector to execute a single query (not 1000 unitary queries) about this two fields.
I expect the connector to be able to use a List of Maps as input, as it does using update/insert operations. So, I tried with this Connector config:
I am getting as response a ConsumerIterator. If I do a Object to String transformer but I am getting an empty String as response.
I guess must be a way of executing a big query in just one API call... But I am not finding it. Have in mind I need to use two or more WHERE clauses.
Any idea? Thanks!

I think you need to create two separate list for id and Name values from your input and then use those list in the query using IN.

Construct id list to be used in where clause. This can be executed inside for each with batch size 1000.
Retrieve name and id from contact for each batch
select id, name from contact where id in (id list)
Get the desired id's by matching name retrieved in step 2 within mule.

Related

How can I get information about table usage?

I'm new to Snowflake and trying to get a ranking of table usage which means how many queries requested in a certain period of time for each table. I found out this link but could get query text not a table name. Should I parse the query text and extract table names or find another fancy way? If the first one is true, is there a good SQL parser library for python?
You can use the SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY view to see object usage.
This will get you started. The flatten function turns an array in BASE_OBJECTS_ACCESSED into rows so you can aggregate, count, etc. Check the VALUE column for what you can count, aggregate, etc.
select * from
"SNOWFLAKE"."ACCOUNT_USAGE"."ACCESS_HISTORY",
table(flatten(BASE_OBJECTS_ACCESSED))
;

How to send email when input query Salesforce object component(postgresql) fetching or output table (mssql) unloading zero record or empty records

In an existing graph I wanted to have a check on any one of the query Salesforce object component or output table component weather it is writting or unloading zero records and i wanted get notified by email about the same. What will be the better way out of these : creating wrapper script, using parameters, adding the transformations, creating intermediate files, use run program, end script or writing stored procedure?
you can do this in Graph. component for send Email with attachment is available in GDE. just do not forget to change layer number to highest one for Email component.

What is the best method to exclude data and query parts of data in a Swift Firebase query?

I am querying users from Firebase and would like to know the best method to query all users excluding the current ref.authData.uid . In parse its read like this......
query?.whereKey("username", notEqualTo: PFUser.currentUser()!.username!)
query?.whereKey("username", containsString: self.searchTXTFLD.text)
Also, is there any Firebase query type similar to Parse's containsString?
There is no way to retrieve only items from Firebase that don't match a certain condition. You'll have to retrieve all items and exclude the offending ones client-side. Also see is it possible query data that are not equal to the specified condition?
There is also no contains operator for Firebase queries. This has been covered many times before, such as in this question: Firebase query - Find item with child that contains string

Extracting user details from a DB and using these to login via Jmeter

I have a db full of users (3 million) that I want to use during testing, I do not want to create or use the csv file method for this. I would like to pick a new user each time to login with.
In my test plan I have a once only controller where I have put a JDBC connection to my DB and two JDBC processors
one that counts the number of users in the DB $users
one that selects all the emails in the DB that fit a certain criteria I return this as an an array of emails $emails
What I am struggling with is using these to construct a loop that selects a different email each time so I can pass these as inputs to my login requests. Each thread should use a different email address.
Are you setting the variable names textbox in your JDBC sampler?
You can use the _index notation to access the results returned by the JDBC sampler. For example, if your query returns a single column of data, and you put emails in the variable names textbox, then:
emails_# will contain the number of result rows
emails_1 will contain the first row value
emails_2 will contain second row value and so on..
ref: JDBC Sampler
You could use the following SQL query to get random email:
SELECT email FROM table WHERE your_criteria = 'something' ORDER BY RAND() LIMIT 1;
directly in the JDBC PreProcessor where random email is required.
Pre/Post Processors and Timers processing time is not included into response time by default so it is quite "safe" operation (unless you use Transaction Controller).

Salesforce - how can I search for all Opportunity custom fields that are empty (never been populated) for every Opportunity record?

I need to search for any opportunity's custom field that are empty for every record, so that I can delete those fields that are not used by the users. Can I do this by report or by DevConsole, with some query?
I think there are three options that would work best:
Data Loader
Use their Data Loader to export all of your opportunities into a CSV. Load it up in Excel or some other software of your choice and manually dig through the columns ending in __c looking for at least one value.
SOQL
You could manually write a SOQL query that looks at each field (e.g. SELECT Id FROM Opportunity WHERE YourCustomField1__c != null and repeat for each field)
SOQL (Dynamic)
If you're willing to get your programming hands dirty you could make a describe API call to fetch all the fields on the opportunity object. Once you know all the fields you could find fields that end in __c again and write a dynamic SOQL statement to hit the API with.
The Field Trip app (free in the AppExchange) will do this for you. Here's a link:
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003HSXEEA4
Run it for an object and it gives you a report that lists all the field and tells you what % of records are filled in for each field. My organization has been using it for several years now.
I'm not connected with Qandor. I'm just a satisfied user.

Resources