---
schema_version: "1"
id: a9d227d3e79dcc888ec2805a3645232409acca688ab416990740fc62366c766b
title: Snowflake Connector 1.4 Examples
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/snowflake-connector/latest/snowflake-connector-examples.md
canonical_url: https://docs.mulesoft.com/snowflake-connector/latest/snowflake-connector-examples
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 094a124ab8f30e3ebea1de2e19dc69a58b49d129b77724d2ec369f1b2792220f
description: MuleSoft Documentation Site
release: "1.4"
latest: true
---
---
product: Snowflake Connector
version: 1.4
is-latest-version: true
---

# Snowflake Connector 1.4 Examples

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

The following example returns all rows of a table based on a watermark.

This example uses variables for some field values. You can either:

- Replace the variables with their values in the code.

- Provide the values for each variable in a properties file and then refer to that file from the
  connector configuration.

If you don’t know how to use a properties file, refer to
[Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure).

Before you try the examples, access Anypoint Studio (Studio) and verify that the **Mule Palette**
view displays entries for Snowflake Connector. If not, follow the instructions in
[Add the Connector to Your Mule Project](https://docs.mulesoft.com/snowflake-connector/latest/snowflake-connector-studio#add-connector-to-project).

## Return All Rows of a Table

This example shows how to use the **On Table Row** source to return rows that contain columns with a
greater watermark value than that of the last watermark processed.

The following screenshot shows the app flow for this example:

![Studio Flow for the On Table Row source](/mulesoft/current/en-us/snowflake-connector/latest/_images/listener-flow.png)

### Add the On Table Row Source

The **On Table Row** source selects from a table at a regular interval and generates one message per
obtained row.

1.  In the **Mule Palette** view, select **Snowflake** and drag the **On Table Row** source to the
    canvas.

2.  In the Search properties window, click **+** next to the **Connector configuration** field to
    add a global element.

3.  Enter the following values:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Configuration</p></td><td><p>Name of the configuration.</p></td></tr><tr><td><p>Config Ref</p></td><td><p><code>Snowflake_Config</code></p></td></tr><tr><td><p>Table</p></td><td><p><code>USERS</code></p></td></tr><tr><td><p>Watermark Column</p></td><td><p><code>CREATION_DATE</code></p></td></tr><tr><td><p>Id Column</p></td><td><p><code>ID</code></p></td></tr><tr><td><p>Since</p></td><td><p><code>2021-12-14 11:00:00.000</code></p></td></tr></tbody></table>

### Add the Transform Message Component

The **Transform Message** component outputs the rows of the table in JSON format.

1.  In the **Mule Palette** view, select **Core** and drag the **Transform Message** component to
    the right of **On Table Row**.

2.  Click the **Transform Message** component and set the output format to `application/json`.

### Add the Logger Component

The **Logger** component logs the query result to the console.

1.  In the **Mule Palette** view, select **Core** and drag the **Logger** component to the right of
    **Transform Message**.

2.  Enter the following values:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p><code>Logger</code></p></td></tr><tr><td><p>Message</p></td><td><p><code>payload</code></p></td></tr><tr><td><p>Level</p></td><td><p><code>INFO (Default)</code></p></td></tr></tbody></table>

### XML for This Example

Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:

```xml
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:snowflake="http://www.mulesoft.org/schema/mule/snowflake"
	xmlns:salesforce="http://www.mulesoft.org/schema/mule/salesforce" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/snowflake http://www.mulesoft.org/schema/mule/snowflake/current/mule-snowflake.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">

	<configuration-properties file="mule-app.properties"/>

	<snowflake:snowflake-config name="Snowflake_Config" >
		<snowflake:snowflake-connection accountName="${config.accountName}" warehouse="${config.warehouse}" database="${config.database}" schema="${config.schema}" user="${config.user}" password="${config.password}" role="${config.role}"/>
	</snowflake:snowflake-config>
	<snowflake:snowflake-config name="keyPairWithPasswordConfig" >
        	<snowflake:keypair-connection user="${config.user}"  accountName="${config.accountName}" warehouse="${config.warehouse}" database="${config.database}" schema="${config.schema}" privateKeyFile="${app.home}/rsa_key_encrypted.p8" privateKeyPassword="${config.user.keypair.password}" role="${config.role}"/>
    </snowflake:snowflake-config>
	<flow name="listener-flow" >
		<snowflake:row-listener doc:name="Row Listener" config-ref="Snowflake_Config" table="USERS" watermarkColumn="CREATION_DATE" idColumn="ID" since="2021-12-14 11:00:00.000">
			<scheduling-strategy >
				<fixed-frequency />
			</scheduling-strategy>
		</snowflake:row-listener>
		<ee:transform doc:name="Transform Message" >
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<logger level="INFO" doc:name="Logger" message="#[payload]"/>
	</flow>
</mule>
```

### Steps for Running This Example

1.  Verify that your connector is configured.

2.  Save the project.

3.  The terminal will display the new messages for this source.

## See Also

- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)

- [Salesforce Help](https://help.salesforce.com)
