Commit d034520
feat: implement STRUCT type support for PyAthena SQLAlchemy dialect
This commit adds comprehensive STRUCT type support to PyAthena, addressing GitHub issue #454.
Changes include:
- Add struct converter function in converter.py for JSON-to-dict conversion
- Implement AthenaStruct type class with field definitions and SQLAlchemy integration
- Add struct compilation support in type compiler with visit_struct/visit_STRUCT methods
- Refactor code organization by moving compiler classes to compiler.py
- Move identifier preparer classes to preparer.py for better separation of concerns
- Add comprehensive test coverage for all struct functionality
- Update ischema_names mapping to recognize struct/row types
Benefits:
- Enables querying and manipulating STRUCT/ROW data types in Athena
- Provides type-safe field access and validation
- Maintains full backward compatibility with existing code
- Follows PyAthena's architectural patterns and DB API 2.0 compliance
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 21cbf05 commit d034520
8 files changed
Lines changed: 806 additions & 588 deletions
File tree
- pyathena
- sqlalchemy
- tests/pyathena
- sqlalchemy
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
| |||
101 | 111 | | |
102 | 112 | | |
103 | 113 | | |
104 | | - | |
| 114 | + | |
105 | 115 | | |
106 | 116 | | |
107 | 117 | | |
| |||
0 commit comments