Skip to content

fix(datastream-to-bigquery): Added code to read SQLServer Primary Keys from replication_index instead of primary_keys metadata field (Issue #3805)#3844

Open
sandesh-jagdale-tp wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
sandesh-jagdale-tp:main
Open

fix(datastream-to-bigquery): Added code to read SQLServer Primary Keys from replication_index instead of primary_keys metadata field (Issue #3805)#3844
sandesh-jagdale-tp wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
sandesh-jagdale-tp:main

Conversation

@sandesh-jagdale-tp
Copy link
Copy Markdown

This is a repeat and clean pull request for Issue #3805. This contains only changes associated with fixing the reading of SQLServer primary key from "replication_index" metadata field instead of "primary_key" field.

This replaces the earlier pull request #3806.

…s from replication_index instead of primary_keys metadata field (Issue GoogleCloudPlatform#3805)
@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 21, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Copy Markdown

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 addresses an issue where SQL Server primary keys were not being correctly identified. By introducing a fallback mechanism to the 'replication_index' metadata field, the system now correctly handles primary key extraction for SQL Server sources while maintaining compatibility with existing MySQL, Oracle, and PostgreSQL implementations.

Highlights

  • SQL Server Primary Key Resolution: Updated the primary key extraction logic to prioritize the 'primary_keys' field and fallback to 'replication_index' when processing SQL Server records.
  • Enhanced Test Coverage: Added comprehensive unit tests to verify primary key extraction across various scenarios, including fallback behavior and cases where neither field is present.
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 the 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 counterproductive. 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.

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.

Copy link
Copy Markdown

@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 updates the getPrimaryKeys logic in both FormatDatastreamJsonToJson and FormatDatastreamRecordToJson to support a fallback to replication_index for SQL Server when primary_keys are missing. Comprehensive unit tests were added to verify this behavior across different database types and scenarios. Feedback was provided to optimize the implementation in FormatDatastreamRecordToJson by avoiding redundant schema lookups and expensive JSON parsing calls, suggesting a more efficient approach that aligns with the logic used in other parts of the codebase.

@damccorm
Copy link
Copy Markdown
Contributor

@dhercher could you please take a look?

@sandesh-jagdale-tp
Copy link
Copy Markdown
Author

Hello @dhercher Is there any review feedback for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants