Skip to content

Add PubSubToAlloyDb Yaml template#3457

Open
wladabutenko wants to merge 8 commits intoGoogleCloudPlatform:mainfrom
wladabutenko:pubsub_alloydb_template
Open

Add PubSubToAlloyDb Yaml template#3457
wladabutenko wants to merge 8 commits intoGoogleCloudPlatform:mainfrom
wladabutenko:pubsub_alloydb_template

Conversation

@wladabutenko
Copy link
Contributor

@wladabutenko wladabutenko commented Mar 9, 2026

Streaming YAML template reads messages from a Pub/Sub subscription, applies a user-defined mapping to extract and transform fields, and groups messages using the configured windowing. Successful records are written to an AlloyDB (Postgres) table via JDBC using the provided write statement and connection options. TransformData errors are published to a configured dead-letter Pub/Sub topic for separate inspection.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a new streaming Dataflow template designed to facilitate the ingestion and transformation of data from Google Cloud Pub/Sub into AlloyDB. It provides a flexible, YAML-driven approach to define data mappings and includes robust error handling to ensure data integrity and observability for failed records.

Highlights

  • New Template Added: Introduced a new YAML-based Dataflow template named PubSubToAlloyDbYaml for streaming data from Pub/Sub to AlloyDB.
  • Data Transformation and Loading: The template supports user-defined data mapping and transformation, windowing, and writes successful records to an AlloyDB (Postgres) table via JDBC.
  • Error Handling: Implemented a dead-letter Pub/Sub topic for handling and inspecting messages that fail during transformation or writing to AlloyDB.
  • Comprehensive Documentation and Testing: Added detailed README documentation for the new template, including parameters, setup, and execution instructions, along with a dedicated integration test.
Changelog
  • yaml/README_PubSub_To_AlloyDb_Yaml.md
    • Added comprehensive documentation for the new PubSub to AlloyDB YAML template, detailing required and optional parameters, getting started instructions, and Terraform integration.
  • yaml/src/main/java/com/google/cloud/teleport/templates/yaml/PubSubToAlloyDbYaml.java
    • Added the Java interface for the PubSub to AlloyDB YAML template, defining its metadata and all configurable parameters.
  • yaml/src/main/python/options/alloydb_options.yaml
    • Added YAML configuration options specifically for AlloyDB connection and write parameters, including JDBC URL, credentials, and batching settings.
  • yaml/src/main/yaml/PubSubToAlloyDb.yaml
    • Added the core YAML pipeline definition for the PubSub to AlloyDB template, outlining the data flow from Pub/Sub reading, through mapping and windowing, to writing to AlloyDB and handling errors.
  • yaml/src/test/java/com/google/cloud/teleport/templates/yaml/PubSubToAlloyDBYamlIT.java
    • Added an integration test to validate the functionality of the PubSub to AlloyDB YAML template, including successful data writes and dead-letter queue handling.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@wladabutenko
Copy link
Contributor Author

R: @derrickaw

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new YAML template for streaming data from Pub/Sub to AlloyDB. A critical security vulnerability exists due to improper escaping of user-provided parameters in the Jinja2 YAML pipeline definition, which can lead to YAML injection and Remote Code Execution (RCE) on Dataflow workers. Furthermore, sensitive information like the database password is logged in plain text by the template launcher. Beyond these security concerns, there are several areas for improvement regarding documentation clarity and naming conventions, including incorrect documentation for windowing parameters in the README and misleading parameter names (e.g., location for the table name).

@derrickaw derrickaw added the addition New feature or request label Mar 11, 2026
@wladabutenko wladabutenko force-pushed the pubsub_alloydb_template branch from 5832616 to 523df40 Compare March 16, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition New feature or request size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants