gemini-code-assist[bot] commented on code in PR #36036:
URL: https://github.com/apache/beam/pull/36036#discussion_r2320095874


##########
sdks/python/apache_beam/yaml/examples/transforms/blueprint/iceberg_to_alloydb.yaml:
##########
@@ -0,0 +1,51 @@
+# coding=utf-8
+#
+# 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.
+
+# A pipeline that reads from iceberg table and writes to AlloyDB.
+
+pipeline:
+  type: chain
+  transforms:
+    # Step 1: Reading data from Iceberg
+    - type: ReadFromIceberg
+      name: ReadFromIcebergTable
+      config:
+        table: "db.users.NY"
+        catalog_name: "hadoop_catalog"
+        catalog_properties:
+          type: "hadoop"
+          warehouse: "gs://MY-WAREHOUSE"
+        # Hadoop catalog config required to run pipeline locally
+        # Omit if running on Dataflow
+        config_properties:
+          "fs.gs.auth.type": "SERVICE_ACCOUNT_JSON_KEYFILE"
+          "fs.gs.auth.service.account.json.keyfile": 
"/path/to/service/account/key.json"
+
+    # Step 2: Write records out to AlloyDB
+    # To run pipeline locally, Modify alloydbIpType to PUBLIC
+    - type: WriteToJdbc
+      name: WriteToAlloyDBTable
+      config:
+        location: "users"
+        driver_class_name: "org.postgresql.Driver"
+        jdbc_url: 
"jdbc:postgresql:///db?socketFactory=com.google.cloud.alloydb.SocketFactory&alloydbInstanceName=projects/<PROJECT>/locations/<REGION>/clusters/<CLUSTER>/instances/<INSTANCE>&alloydbIpType=PRIVATE"
+        username: "user"
+        password: "password"

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Hardcoding default credentials like `user` and `password`, even in an 
example or blueprint, can pose a security risk. Users might copy this 
configuration into production environments without changing them. It is a 
better practice to use explicit placeholders to make it clear that these values 
must be replaced with actual credentials.
   
   ```yaml
           username: "<YOUR_USERNAME>"
           password: "<YOUR_PASSWORD>"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to