dropbox / dropbox/sqlalchemy-stubs

Change JSON type from Dict to Mapping

Open
#91 3 comments 1 reaction 0 assignees View on GitHub
needs discussion priority-normal topic-stubs
Dominant language
Python
Stars
583
Forks
96
PR merge metrics
No merged PRs in 30d

Description

Would it be possible to make the type for `JSON` columns accept `Mapping[str, Any]` instead of (in addition to?) `Dict[str, Any]`? My specific use case is I have a fixed JSON schema that I represent with a [`TypedDict`](https://mypy.readthedocs.io/en/latest/more_types.html#typeddict), but this is only compatible with `Mapping`, not `Dict`, so I have to either ignore the type or `cast` it when creating the column.

Even better would be if the plugin could somehow remember that it got a `TypedDict` and return that instead of a plain `Dict` or `Mapping` when you access the column later.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.