Closed Bingdom closed 1 year ago
Meet the same issue
Can customize extra_sqlalchemy_type_to_strawberry_type_map
when initialize StrawberrySQLAlchemyMapper
to solve this issue. Works well for my case.
from strawberry.scalars import JSON as StrawberryJSON
from sqlalchemy import JSON as SQLAlchemyJSON
_strawberryMapper = StrawberrySQLAlchemyMapper(
extra_sqlalchemy_type_to_strawberry_type_map={
SQLAlchemyJSON: StrawberryJSON,
}
)
Hello, I've just submitted a Pull Request to enable native JSON conversion. I'm unsure if this is an actual issue or if the library is intentionally designed to not support scalar types, but I went ahead and made the changes anyway.
Describe the Bug
Using the JSON type as a column in sqlalchemy shows as not supported for strawberry sqlalchemy mapper.
However, strawberry does already have a built-in JSON type.
And using this works perfectly fine when creating the type manually.
Example code:
Upvote & Fund