crate / crate/sqlalchemy-cratedb

MutableDict wrapper on ObjectType breaks forward/reverse type mapping

Open
#238 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
9
Forks
4
Avg merge
6d 12h
Merged PRs (30d)
3

Description

## Problem

The `MutableDict.as_mutable()` wrapper applied to `ObjectTypeImpl` is causing issues with forward and reverse type mapping procedures.

The problematic code is:
```python
ObjectType = MutableDict.as_mutable(ObjectTypeImpl)
```

Reference: https://github.com/crate/sqlalchemy-cratedb/blob/d3f02917992a4d6d03a2c28057c6f8107d752e51/src/sqlalchemy_cratedb/type/object.py#L71-L72

## Impact

When using `ObjectType` in type mapping dictionaries, the `MutableDict` wrapper interferes with type resolution. This requires workarounds like using `ObjectTypeImpl()` directly instead of `ObjectType`.

## Context

This issue was discovered while implementing history mode support in the Fivetran destination connector:
- PR: https://github.com/crate/cratedb-fivetran-destination/pull/112
- Comment: https://github.com/crate/cratedb-fivetran-destination/pull/112#discussion_r2575091791

## Workaround

Currently working around by using `ObjectTypeImpl()` directly in type mappings instead of `ObjectType`.

---
Reported by: @amotl

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.