feat(sqlalchemy-bigquery): add JSON type support to BigQueryTypeCompiler#16124
feat(sqlalchemy-bigquery): add JSON type support to BigQueryTypeCompiler#16124geoHeil wants to merge 1 commit intogoogleapis:mainfrom
Conversation
|
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. |
Summary of ChangesHello, 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 introduces comprehensive support for the JSON data type within the Highlights
Using Gemini Code AssistThe 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
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 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for the JSON data type in sqlalchemy-bigquery, which is a valuable feature enhancement. The implementation is straightforward and correct, including adding the type mapping, the compiler visit method, and exporting the new type. A unit test is also included to verify the change. I have a minor suggestion for improving code maintainability by keeping type assignments sorted, consistent with other parts of the codebase.
BigQuery has natively supported the JSON type since 2022, but the SQLAlchemy dialect was missing visit_JSON in BigQueryTypeCompiler and the JSON entry in _type_map. This caused UnsupportedCompilationError when creating tables with sa.JSON() columns via Alembic. Changes: - Add visit_JSON to BigQueryTypeCompiler returning "JSON" - Add "JSON" to _type_map mapping to sqlalchemy.types.JSON - Export JSON from the package __init__.py - Add unit test for JSON column DDL compilation Fixes: googleapis#16123
764ca52 to
dc6761e
Compare
Description
BigQuery has natively supported the
JSONtype since 2022, butsqlalchemy-bigquerydoes not map it. This causesUnsupportedCompilationErrorwhen creating tables withsa.JSON()columns:Changes
base.py: Addvisit_JSONtoBigQueryTypeCompiler, returning"JSON"_types.py: Add"JSON": sqlalchemy.types.JSONto_type_mapand exportJSON__init__.py: ExportJSONfrom the packagetests/unit/test_compiler.py: Add unit test for JSON column DDL compilationTesting
All 314 existing unit tests pass. New test verifies
sa.JSON()compiles toJSONinCREATE TABLEDDL.Context
Discovered while setting up Alembic migrations for Metaxy's BigQuery metadata store.
Fixes #16123