GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: support load_table and list_rows with picosecond timestamp by Linchin · Pull Request #2351 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@Linchin

@Linchin Linchin commented Dec 30, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Support picosecond in Client.load_table_from_file()
  • Support picosecond in Client.list_rows()

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Linchin
feat: support load table with picosecond timestamp
f4c9b6a
@Linchin
Linchin requested a review from a team December 30, 2025 22:38
@blunderbuss-gcf blunderbuss-gcf Bot assigned iam-ethan-huang Dec 30, 2025
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery API. labels Dec 30, 2025
@gemini-code-assist

gemini-code-assist Bot commented Dec 30, 2025

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Linchin, 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 integrates a new capability into the BigQuery client library, allowing for precise control over timestamp data during table load operations. By introducing the timestamp_target_precision property, users can now define the subsecond precision for TIMESTAMP columns, including support for picoseconds, ensuring that time-sensitive data is accurately handled and stored when using autodetection, especially for CSV data sources.

Highlights

  • New Feature: Timestamp Target Precision: Introduced a new timestamp_target_precision property to the LoadJob class, allowing users to specify the desired precision for TIMESTAMP types during BigQuery table loading with autodetection.
  • Picosecond Timestamp Support: This enhancement enables the handling of picosecond-level timestamp data (up to 12 digits of subseconds), providing more granular control over timestamp interpretation, particularly for CSV-formatted data.
  • Comprehensive Unit Tests: Added a suite of unit tests to test_load_config.py to ensure the correct functionality of the timestamp_target_precision property, covering its getter, setter, and proper serialization/deserialization with API representations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot]
gemini-code-assist Bot reviewed Dec 30, 2025
View reviewed changes

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

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 adds support for timestamp_target_precision in LoadJobConfig, which allows specifying target precisions for TIMESTAMP types during data loading with autodetection. The implementation looks good and is well-tested.

For future improvement and API consistency, consider exposing this new property on the LoadJob class as well, similar to how other LoadJobConfig properties are exposed. This would involve adding a corresponding read-only property to LoadJob that delegates to self.configuration.timestamp_target_precision.

I've also left a minor comment about a style issue in the docstring.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigquery/job/load.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Linchin
add tests and list_rows() support
3220439
@Linchin Linchin changed the title feat: support load table with picosecond timestamp feat: support load_table and list_rows with picosecond timestamp Dec 31, 2025
@Linchin Linchin added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Dec 31, 2025
@Linchin
docstring
4281ef5
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Dec 31, 2025
Linchin added 2 commits December 31, 2025 01:08
@Linchin
lint
d786b3f
@Linchin
support query()
4812857
@product-auto-label product-auto-label Bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Dec 31, 2025
@Linchin
improve unit test
73156f7
daniel-sanche
daniel-sanche reviewed Jan 5, 2026
View reviewed changes
Comment thread google/cloud/bigquery/client.py
raise ValueError(
"Picosecond Timestamp is only supported when `api_method "
"== enums.QueryApiMethod.QUERY`."
)

@daniel-sanche daniel-sanche Jan 5, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nit: if this is true, maybe the conditional should be api_method != enums.QueryApiMethod.QUERY ?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Linchin Linchin Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This is a really good catch! I will correct it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Linchin Linchin Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigquery/client.py Outdated

if timestamp_precision == enums.TimestampPrecision.PICOSECOND:
# Cannot specify both use_int64_timestamp and timestamp_output_format.
del params["formatOptions.useInt64Timestamp"]

@daniel-sanche daniel-sanche Jan 5, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

instead of setting this and deleting it, can this just be in an else branch?

if timestamp_precision == enums.TimestampPrecision.PICOSECOND:
  params["formatOptions.timestampOutputFormat"] = "ISO8601_STRING"
else:
  params["formatOptions.useInt64Timestamp"] = True

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Linchin Linchin Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good idea, done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigquery/_helpers.py
"""Coerce 'value' to a datetime, if set or not nullable. If timestamp
is of picosecond precision, preserve the string format."""
if field.timestamp_precision == enums.TimestampPrecision.PICOSECOND:
return value

@daniel-sanche daniel-sanche Jan 5, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nit: this method might benefit from a return type annotation. (It looks like datetime | string | None?)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Linchin Linchin Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigquery/_job_helpers.py Outdated

if timestamp_precision == enums.TimestampPrecision.PICOSECOND:
# Cannot specify both use_int64_timestamp and timestamp_output_format.
del request_body["formatOptions"]["useInt64Timestamp"]

@daniel-sanche daniel-sanche Jan 5, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I commented this elsewhere, but it seems like useInt64Timestamp could just be set in an else branch

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Linchin Linchin Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Indeed, I have updated the code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Linchin added 6 commits January 5, 2026 23:53
@Linchin
address comments
d18a043
@Linchin
type hint
4d0a8c4
@Linchin
fix pytype test
50e6af4
@Linchin
fix pytype
cf0c61d
@Linchin
use # type ignore instead
fc33078
@Linchin
revert type check
ab24d7f
daniel-sanche
daniel-sanche approved these changes Jan 6, 2026
View reviewed changes

@daniel-sanche daniel-sanche left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Linchin
Linchin merged commit 46764a5 into googleapis:main Jan 6, 2026
@Linchin Linchin mentioned this pull request Jan 8, 2026
chore: librarian release pull request: 20260108T001607Z #2355
Merged
Linchin added a commit that referenced this pull request Jan 8, 2026
@Linchin
chore: librarian release pull request: 20260108T001607Z (#2355)
40b4cbf
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v0.7.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:c8612d3fffb3f6a32353b2d1abd16b61e87811866f7ec9d65b59b02eb452a620
<details><summary>google-cloud-bigquery: 3.40.0</summary>

##
[3.40.0](v3.39.0...v3.40.0)
(2026-01-08)

### Features

* support load_table and list_rows with picosecond timestamp (#2351)
([46764a5](46764a59))

* support timestamp_precision in table schema (#2333)
([8d5785a](8d5785ae))

</details>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
@daniel-sanche daniel-sanche daniel-sanche approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@iam-ethan-huang iam-ethan-huang

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. size: l Pull request size is large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@Linchin @daniel-sanche @iam-ethan-huang @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.