Querying Data
The connector executes streamed SELECT queries by default; that is, it pushes results as soon as they are received. Follow the steps below to configure different aspects of query execution.
Configuring Queries in the Visual Editor
To configure a SELECT query in the Visual Editor, select the connector inside your flow and specify the following connector properties:
- Connector Configuration: Select a connection you created. See Establishing a Connection for more information.
- Operation: Choose SELECT.
- SQL query: Enter the SELECT query. Your SQL statement can contain MEL expressions like in the following example.
SELECT * FROM Subscriber WHERE EmailAddress = #[flowVars.EmailAddress]
- Query type: By default, the connector executes parameterized queries. Choose the Dynamic query type to override this. See Parameterized Queries for more information.
- Fetch size: Set this to the number of items to return per page. Or, set Fetch Size to -1 if you want the connector to download the full results of the query before pushing anything.
- Max rows: Set this to limit the total rows to return from the result set.
Configuring Queries in the XML Editor
To configure a SELECT query in XML, add a block like the following to your Mule configuration:
<cdata-sfmarketingcloud:select-advanced config-ref="CData_SFMarketingCloud_Configuration" query="SELECT * FROM Subscriber WHERE EmailAddress = #[flowVars.EmailAddress]" doc:name="CData SFMarketingCloud"/>
You can configure the following fields in the <cdata-sfmarketingcloud:select-advanced> element:
- config-ref: References a connection you created. See Establishing a Connection for more information.
- query: Specifies the SELECT statement.
- queryType: By default, the connector is configured to execute parameterized queries. Set the queryType field to "Dynamic" to override this. See Parameterized Queries for more information.
- fetchSize: Set this to the items to return per page. Set fetchSize to -1 to download the full results of the query before pushing anything.
- maxRows: Set this to limit the total number of items to return from the result set.