Repository navigation
fix(sqlalchemy-bigquery): compile func.now() to CURRENT_TIMESTAMP - #18994
Merged
parthea merged 1 commit intoNov 5, 2026
Merged
Conversation
BigQuery has no NOW() function, so queries and server defaults that use func.now() failed. Compile it to CURRENT_TIMESTAMP instead, the same way other SQLAlchemy dialects do. Fixes googleapis#15762
abhishekacharya200
requested review from
sindhuvy
and removed request for
a team
November 5, 2026 07:56
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for compiling the SQL NOW() function to CURRENT_TIMESTAMP in the BigQuery dialect, since BigQuery does not natively support NOW(). A corresponding unit test has also been added to verify this behavior. There are no review comments, and I have no feedback to provide.
parthea
approved these changes
Nov 5, 2026
ohmayr
approved these changes
Nov 5, 2026
parthea
enabled auto-merge (squash)
November 5, 2026 17:39
parthea
added a commit
that referenced
this pull request
Nov 12, 2026
🤖 I have created a release *beep* *boop* --- ## [1.18.0](sqlalchemy-bigquery-v1.17.3...sqlalchemy-bigquery-v1.18.0) (2026-11-12) ### Features * **sqlalchemy-bigquery:** support BigQuery SAFE_CAST and SQLAlchemy 2.0 try_cast ([#18953](#18953)) ([931968b](931968b)) * support Python 3.15 ([8fceef4](8fceef4)) ### Bug Fixes * **sqlalchemy-bigquery:** compile func.now() to CURRENT_TIMESTAMP ([#18994](#18994)) ([07df830](07df830)) * **sqlalchemy-bigquery:** restore String bindparam type for GeoAlchemy2 0.21.0 ([#18985](#18985)) ([edc4372](edc4372)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #15762
BigQuery has no
NOW()function, butfunc.now()compiled tonow()with this dialect, so queries andserver_default=func.now()columns failed in BigQuery.This adds
visit_now_functoBigQueryCompilersofunc.now()compiles toCURRENT_TIMESTAMP. That is whatfunc.current_timestamp()already compiles to here, and it matches how the SQLite, MSSQL and Oracle dialects handlenow().Added
test_now_compiles_to_current_timestampintests/unit/test_compiler.py, which fails onmain(SELECT now() AS ts) and passes with this change. The package's unit tests pass locally, and the noxfile's ruff 0.14.14 checks, flake8 and black report nothing on the changed files.