Add JSON type support for SQLAlchemy dialect#620
Merged
laughingman7743 merged 1 commit intomasterfrom Nov 8, 2025
Merged
Conversation
Implement JSON type support to resolve GitHub Issue #619. This enables proper handling of JSON columns when reflecting Iceberg tables and querying JSON data with SQLAlchemy. Changes: - Add visit_JSON method to AthenaTypeCompiler - Update ischema_names mapping from String to JSON type - Add unit test for JSON type compilation - Add integration test for JSON type with CAST operations - Update documentation with JSON Type Support section - Reorganize documentation structure (move Query Execution Callback section) Limitations: - Athena only supports JSON objects, not top-level arrays - JSON type is for DML operations (SELECT), not DDL (CREATE TABLE) Fixes #619 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.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.
Summary
This PR implements JSON type support for the PyAthena SQLAlchemy dialect to resolve Issue #619.
Changes
visit_JSONmethod toAthenaTypeCompilerinpyathena/sqlalchemy/compiler.pyischema_namesmapping inpyathena/sqlalchemy/base.pyto usetypes.JSONinstead oftypes.Stringtests/pyathena/sqlalchemy/test_compiler.pyto verify JSON type compilationtests/pyathena/sqlalchemy/test_base.pyto test JSON type with CAST operationsdocs/sqlalchemy.rst:Key Features
Athena JSON Type Limitations
[1, 2, 3]will fail withInvalidRequestExceptionTest Results
All tests pass successfully:
Example Usage
Fixes #619
🤖 Generated with Claude Code