Skip to content

fix: Support Creation of JSON columns#16733

Open
waltaskew wants to merge 1 commit intogoogleapis:mainfrom
waltaskew:json-bigquery
Open

fix: Support Creation of JSON columns#16733
waltaskew wants to merge 1 commit intogoogleapis:mainfrom
waltaskew:json-bigquery

Conversation

@waltaskew
Copy link
Copy Markdown
Contributor

Fixes #15761

@waltaskew waltaskew requested review from a team as code owners April 20, 2026 20:19
@waltaskew waltaskew requested review from mpovoa and removed request for a team April 20, 2026 20:19
Copy link
Copy Markdown
Contributor

@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 adds support for the JSON data type in the BigQuery SQLAlchemy dialect by implementing the visit_JSON method and adding a corresponding unit test. Feedback was provided to include a JSONB alias for better compatibility with models using PostgreSQL-specific types.

Comment on lines +625 to +626
def visit_JSON(self, type_, **kw):
return "JSON"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Consider adding an alias for JSONB to improve compatibility with models that use the JSONB type (e.g., those originally designed for PostgreSQL). Since BigQuery's JSON type is binary-optimized, it is the appropriate mapping for JSONB in this dialect.

    def visit_JSON(self, type_, **kw):
        return "JSON"

    visit_JSONB = visit_JSON

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error Creating Table with JSON Column

1 participant