---
schema_version: "1"
id: b3a27b519e76e35bc02dc3aee95e4fac22378782185ec6b3d4b81254afa3d030
title: Snowflake Connector 1.3 の例
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/snowflake-connector/1.3/snowflake-connector-examples.md
canonical_url: https://docs.mulesoft.com/jp/snowflake-connector/1.3/snowflake-connector-examples
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 3faae75d2109854c162d885075fc6a9bdf21366106ad51efd82fb0018dc6d90d
description: MuleSoft Documentation Site
release: "1.3"
latest: true
---
# Snowflake Connector 1.3 の例

次の例では、ウォーターマークに基づいてテーブルのすべての行を返します。

この例では一部の項目値に変数を使用しています。次のいずれかを実行できます。

- コード内で変数を値に置き換える。
- プロパティファイルで各変数の値を指定しておき、コネクタ設定からそのファイルを参照する。

プロパティファイルの使用方法についての詳細は、​[「プロパティプレースホルダーの設定」](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure)​を参照してください。

この例を試す前に、Anypoint Studio (Studio) にアクセスし、​**\[Mule Palette (Mule パレット)\]**​ ビューに Snowflake Connector のエントリが表示されていることを確認します。表示されない場合、​[「コネクタを Mule プロジェクトに追加する」](https://docs.mulesoft.com/jp/snowflake-connector/1.3/snowflake-connector-studio#add-connector-to-project)​の手順に従ってください。

## [](#テーブルのすべての行を返す)テーブルのすべての行を返す

この例では、​**On Table Row**​ ソースを使用して、最後に処理されたウォーターマークよりもウォーターマーク値が大きい列を含む行を返す方法を示します。

次のスクリーンショットは、この例のアプリケーションフローを示しています。

![On Table Row ソースの Studio フロー](/mulesoft/current/ja-jp/snowflake-connector/1.3/_images/listener-flow.png)

### [](#始める前に)始める前に

- Java 8、11、または 17
- Anypoint Studio 7.5 以降
- Mule Runtime Engine (Mule) 4.3.0 以降

### [](#on-table-row-ソースの追加)On Table Row ソースの追加

**On Table Row**​ ソースは、一定間隔でテーブルから選択し、取得した行ごとに 1 つのメッセージを生成します。

1. **\[Mule Palette (Mule パレット)\]**​ ビューから、​**\[Snowflake\]**​ を選択して ​**\[On Table Row\]**​ ソースをキャンバスにドラッグします。
2. \[Search properties (検索プロパティ)\] ウィンドウで、​**\[Connector configuration (コネクタ設定)\]**​ 項目の横にある ​**\[+\]**​ をクリックしてグローバル要素を追加します。
3. 次の値を入力します。
    
    <table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">項目</th>
<th class="tableblock halign-left valign-top">値</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Configuration (設定)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">設定の名前。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Config Ref (設定参照)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Snowflake_Config</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Table (テーブル)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>USERS</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Watermark Column (ウォーターマーク列)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATION_DATE</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Id Column (ID 列)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ID</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Since (以降)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>2021-12-14 11:00:00.000</code></p></td>
</tr>
</tbody>
</table>

### [](#transform-message-コンポーネントを追加する)\[Transform Message\] コンポーネントを追加する

**\[Transform Message\]**​ コンポーネントでは、テーブルの行を JSON 形式で出力します。

1. **\[Mule Palette (Mule パレット)\]**​ ビューで ​**\[Core (コア)\]**​ を選択して ​**\[Transform Message\]**​ コンポーネントを ​**\[On Table Row\]**​ の右側にドラッグします。
2. **\[Transform Message\]**​ コンポーネントをクリックして、出力形式を ​`application/json`​ に設定します。

### [](#logger-コンポーネントを追加する)Logger コンポーネントを追加する

**\[Logger\]**​ コンポーネントでは、クエリ結果がコンソールに記録されます。

1. **\[Mule Palette (Mule パレット)\]**​ ビューで ​**\[Core (コア)\]**​ を選択して ​**\[Logger\]**​ コンポーネントを ​**\[Transform Message\]**​ の右側にドラッグします。
2. 次の値を入力します。
    
    <table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">項目</th>
<th class="tableblock halign-left valign-top">値</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Display Name (表示名)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Logger</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Message (メッセージ)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>payload</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">レベル</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INFO (デフォルト)</code></p></td>
</tr>
</tbody>
</table>

### [](#この例の-xml)この例の XML

この例のフローをすばやく Mule アプリケーションに読み込むには、次のコードを Studio XML エディターに貼り付けます。

```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>
```

### [](#この例の実行手順)この例の実行手順

1. コネクタが設定されていることを確認します。
2. プロジェクトを保存します。
3. ターミナルにこのソースの新しいメッセージが表示されます。

## [](#関連情報)関連情報

- [Anypoint Connector の概要](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [MuleSoft ヘルプセンター](https://help.mulesoft.com)