Skip to content

BigInt triggers strawberry.scalar deprecation warning #259

Description

@sanderr

Description

strawberry-graphql-0.288.0 (released December 28 2025) deprecated "passing a class to strawberry.scalar". This pattern is used to construct strawberry_sqlalchemy_mapper.scalars.BigInt. Therefore importing strawberry_sqlalchemy_mapper now results in a deprecation warning.

As far as I can tell there is no communicated date or release for when the warning might become an error.

Environment

Assumed to be relevant for all supported Python versions, with strawberry-graphql>=0.288. Verified on Python 3.13.11 with latest versions at the time of writing:

strawberry-graphql==0.316.0
strawberry-sqlalchemy-mapper==0.8.0

Reproduction

python -W error::DeprecationWarning -c 'import strawberry_sqlalchemy_mapper'

Results in:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import strawberry_sqlalchemy_mapper
  File "/home/sander/.virtualenvs/tmp-c18a3b473fddd87/lib/python3.13/site-packages/strawberry_sqlalchemy_mapper/__init__.py", line 21, in <module>
    from .mapper import StrawberrySQLAlchemyMapper
  File "/home/sander/.virtualenvs/tmp-c18a3b473fddd87/lib/python3.13/site-packages/strawberry_sqlalchemy_mapper/mapper.py", line 99, in <module>
    from strawberry_sqlalchemy_mapper.scalars import BigInt
  File "/home/sander/.virtualenvs/tmp-c18a3b473fddd87/lib/python3.13/site-packages/strawberry_sqlalchemy_mapper/scalars.py", line 5, in <module>
    BigInt = strawberry.scalar(
        Union[int, str],  # type: ignore
    ...<3 lines>...
        name="BigInt",
    )
  File "/home/sander/.virtualenvs/tmp-c18a3b473fddd87/lib/python3.13/site-packages/strawberry/types/scalar.py", line 295, in scalar
    return wrap(cls)
  File "/home/sander/.virtualenvs/tmp-c18a3b473fddd87/lib/python3.13/site-packages/strawberry/types/scalar.py", line 274, in wrap
    warnings.warn(
    ~~~~~~~~~~~~~^
        "Passing a class to strawberry.scalar() is deprecated. "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        stacklevel=3,
        ^^^^^^^^^^^^^
    )
    ^
DeprecationWarning: Passing a class to strawberry.scalar() is deprecated. Use StrawberryConfig.scalar_map instead for better type checking support. See: https://strawberry.rocks/docs/types/scalars

Possible fix

The release notes for 0.288.0 contain notes on how to migrate. Unfortunately, the suggested approach looks like it might be a breaking change, which is why I'm opening an issue rather than a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions