MappedAnnotationError with generic types using forward references #1711
Unanswered
zshuzh
asked this question in
Usage Questions
Replies: 1 comment
-
I think you need to put a custom type like that in type_annotation_map, but im not sure if we're able to resolve a generic type like that even from the type map. But also I dont really understand what that whole thing is going to accomplish unless you are using a custom i know you called this a "minimal reproduction" but it's still not clear what you actually mean to do. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm trying to use a
TYPE_CHECKING
block to resolve circular type imports, as described in this discussion. However, my use case is a bit more complex as it involves a generic type, and I can't seem to avoid aMappedAnnotationError
error.Minimal reproduction
I get this error when I try to generate the migration with alembic —
The only thing that works is using
Any
instead of a forward reference, but this loses type safety so I'd like to avoid that if possible. Is there a known way to avoidMappedAnnotationError
in this kind of generic, circular import situation?Beta Was this translation helpful? Give feedback.
All reactions