This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch snowflake-source
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit 87edbc1e176f1d05795861692f945c5d179cb55e
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Wed Feb 14 10:47:26 2024 +0100

    Added a Snowflake Source Kamelet
    
    Signed-off-by: Andrea Cosentino <anco...@gmail.com>
---
 kamelets/snowflake-source.kamelet.yaml | 108 +++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)

diff --git a/kamelets/snowflake-source.kamelet.yaml 
b/kamelets/snowflake-source.kamelet.yaml
new file mode 100644
index 00000000..f59f8072
--- /dev/null
+++ b/kamelets/snowflake-source.kamelet.yaml
@@ -0,0 +1,108 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+  name: snowflake-source
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "4.4.0-SNAPSHOT"
+    camel.apache.org/kamelet.icon: 
"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIGJhc2VQcm9maWxlPSJ0aW55LXBzIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNTY1IDE1NTkiIHdpZHRoPSIxNTY1IiBoZWlnaHQ9IjE1NTkiPgoJPHRpdGxlPmxvZ28tYmx1ZS1zdmcgY29weS1zdmc8L3RpdGxlPgoJPGRlZnM+CgkJPGNsaXBQYXRoIGNsaXBQYXRoVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBpZD0iY3AxIj4KCQkJPHBhdGggZD0iTTAuMjQgMEw2ODkzLjI2IDBMNjg5My4yNiAxNTU4LjIyTDAuMjQgMTU1OC4yMkwwLjI0IDBaIiAvPgoJCTwvY2xpcFBhdGg+Cgk8L2RlZnM+Cg
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "SQL"
+    camel.apache.org/kamelet.namespace: "Database"
+  labels:
+    camel.apache.org/kamelet.type: "source"
+spec:
+  definition:
+    title: "Snowflake Source"
+    description: |-
+      Query data from a Snowflake Database.
+    required:
+      - serverName
+      - username
+      - password
+      - query
+      - databaseName
+    type: object
+    properties:
+      instanceUrl:
+        title: The instance URL
+        description: The instance url
+        type: string
+        example: instance.snowflakecomputing.com
+      username:
+        title: Username
+        description: The username to access a secured Snowflake Database.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      password:
+        title: Password
+        description: The password to access a secured Snowflake Database.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      query:
+        title: Query
+        description: The query to execute against the Snowflake Database.
+        type: string
+        example: 'INSERT INTO accounts (username,city) VALUES 
(:#username,:#city)'
+      databaseName:
+        title: Database Name
+        description: The name of the Snowflake Database.
+        type: string
+      consumedQuery:
+        title: Consumed Query
+        description: A query to run on a tuple consumed.
+        type: string
+        example: 'DELETE FROM accounts where user_id = :#user_id'
+      delay:
+        title: Delay
+        description: The number of milliseconds before the next poll
+        type: integer
+        default: 500
+  types:
+    out:
+      mediaType: application/json
+  dependencies:
+  - "camel:jackson"
+  - "camel:kamelet"
+  - "camel:sql"
+  - "mvn:net.snowflake:snowflake-jdbc:3.14.5"
+  - "mvn:org.apache.commons:commons-dbcp2:2.11.0"
+  template:
+    beans:
+      - name: dsBean
+        type: "#class:net.snowflake.client.jdbc.SnowflakeBasicDataSource"
+        properties:
+          user: '{{username}}'
+          password: '{{password}}'
+          url: 'jdbc:snowflake://{{instanceUrl}}'
+          databaseName: '{{databaseName}}'
+    from:
+      uri: "sql:{{query}}"
+      parameters:
+        dataSource: "#bean:{{dsBean}}"
+        onConsume: "{{?consumedQuery}}"
+        delay: "{{delay}}"
+      steps:
+      - marshal:
+          json: 
+            library: Jackson
+      - to: "kamelet:sink"

Reply via email to