Source: flask-sqlalchemy
Version: 3.1.1-3
Severity: serious
X-Debbugs-CC: sqlalch...@packages.debian.org
Tags: sid trixie
User: debian...@lists.debian.org
Usertags: needs-update
Control: affects -1 src:sqlalchemy

Dear maintainer(s),

With a recent upload of sqlalchemy the autopkgtest of flask-sqlalchemy fails in testing when that autopkgtest is run with the binary packages of sqlalchemy from unstable. It passes when run with only packages from testing. In tabular form:

                       pass            fail
sqlalchemy             from testing    2.0.40+ds1-1
flask-sqlalchemy       from testing    3.1.1-3
all others             from testing    from testing

I copied some of the output at the bottom of this report.

Currently this regression is blocking the migration of sqlalchemy to testing [1]. Of course, sqlalchemy shouldn't just break your autopkgtest (or even worse, your package), but it seems to me that the change in sqlalchemy was intended and your package needs to update to the new situation.

If this is a real problem in your package (and not only in your autopkgtest), the right binary package(s) from sqlalchemy should really add a versioned Breaks on the unfixed version of (one of your) package(s). Note: the Breaks is nice even if the issue is only in the autopkgtest as it helps the migration software to figure out the right versions to combine in the tests.

More information about this bug and the reason for filing it can be found on
https://wiki.debian.org/ContinuousIntegration/RegressionEmailInformation

Paul

[1] https://qa.debian.org/excuses.php?package=sqlalchemy

https://ci.debian.net/data/autopkgtest/testing/amd64/f/flask-sqlalchemy/59452516/log.gz

=================================== FAILURES =================================== 33s ___________________________ test_explicit_table[db2] ___________________________
 33s  33s db = <SQLAlchemy>
 33s  33s     def test_explicit_table(db: SQLAlchemy) -> None:
 33s         user_table = db.Table(
 33s             "user",
 33s             sa.Column("id", sa.Integer, primary_key=True),
 33s             bind_key="auth",
 33s         )
 33s      33s >       class User(db.Model):
33s 33s tests/test_model_bind.py:85: 33s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 33s /usr/lib/python3/dist-packages/flask_sqlalchemy/model.py:124: in __init_subclass__
 33s     super().__init_subclass__(**kwargs)
33s /usr/lib/python3/dist-packages/flask_sqlalchemy/model.py:214: in __init_subclass__
 33s     super().__init_subclass__(**kwargs)
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_api.py:622: in __init_subclass__
 33s     super().__init_subclass__(**kw)
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_api.py:842: in __init_subclass__
 33s     _as_declarative(cls._sa_registry, cls, cls.__dict__)
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_base.py:244: in _as_declarative
 33s     return _MapperConfig.setup_mapping(registry, cls, dict_, None, {})
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_base.py:325: in setup_mapping
 33s     return _ClassScanMapperConfig(
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_base.py:563: in __init__
 33s     self._setup_dataclasses_transforms()
33s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 33s 33s self = <sqlalchemy.orm.decl_base._ClassScanMapperConfig object at 0x7fe767c858b0>
 33s  33s     def _setup_dataclasses_transforms(self) -> None:
 33s         dataclass_setup_arguments = self.dataclass_setup_arguments
 33s         if not dataclass_setup_arguments:
 33s             return
 33s      33s         # can't use is_dataclass since it uses hasattr
 33s         if "__dataclass_fields__" in self.cls.__dict__:
 33s             raise exc.InvalidRequestError(
33s f"Class {self.cls} is already a dataclass; ensure that " 33s "base classes / decorator styles of establishing dataclasses "
 33s                 "are not being mixed. "
 33s                 "This can happen if a class that inherits from "
33s "'MappedAsDataclass', even indirectly, is been mapped with "
 33s                 "'@registry.mapped_as_dataclass'"
 33s             )
33s 33s # can't create a dataclass if __table__ is already there. This would 33s # fail an assertion when calling _get_arguments_for_make_dataclass: 33s # assert False, "Mapped[] received without a mapping declaration"
 33s         if "__table__" in self.cls.__dict__:
 33s >           raise exc.InvalidRequestError(
 33s                 f"Class {self.cls} already defines a '__table__'. "
33s "ORM Annotated Dataclasses do not support a pre-existing "
 33s                 "'__table__' element"
 33s             )
33s E sqlalchemy.exc.InvalidRequestError: Class <class 'test_model_bind.test_explicit_table.<locals>.User'> already defines a '__table__'. ORM Annotated Dataclasses do not support a pre-existing '__table__' element 33s 33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_base.py:1074: InvalidRequestError 33s ___________________________ test_explicit_table[db4] ___________________________
 33s  33s db = <SQLAlchemy>
 33s  33s     def test_explicit_table(db: SQLAlchemy) -> None:
 33s         user_table = db.Table(
 33s             "user",
 33s             sa.Column("id", sa.Integer, primary_key=True),
 33s             bind_key="auth",
 33s         )
 33s      33s >       class User(db.Model):
33s 33s tests/test_model_bind.py:85: 33s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 33s /usr/lib/python3/dist-packages/flask_sqlalchemy/model.py:124: in __init_subclass__
 33s     super().__init_subclass__(**kwargs)
33s /usr/lib/python3/dist-packages/flask_sqlalchemy/model.py:214: in __init_subclass__
 33s     super().__init_subclass__(**kwargs)
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_api.py:622: in __init_subclass__
 33s     super().__init_subclass__(**kw)
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_api.py:964: in __init_subclass__
 33s     _as_declarative(cls._sa_registry, cls, cls.__dict__)
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_base.py:244: in _as_declarative
 33s     return _MapperConfig.setup_mapping(registry, cls, dict_, None, {})
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_base.py:325: in setup_mapping
 33s     return _ClassScanMapperConfig(
33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_base.py:563: in __init__
 33s     self._setup_dataclasses_transforms()
33s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 33s 33s self = <sqlalchemy.orm.decl_base._ClassScanMapperConfig object at 0x7fe767c1ab70>
 33s  33s     def _setup_dataclasses_transforms(self) -> None:
 33s         dataclass_setup_arguments = self.dataclass_setup_arguments
 33s         if not dataclass_setup_arguments:
 33s             return
 33s      33s         # can't use is_dataclass since it uses hasattr
 33s         if "__dataclass_fields__" in self.cls.__dict__:
 33s             raise exc.InvalidRequestError(
33s f"Class {self.cls} is already a dataclass; ensure that " 33s "base classes / decorator styles of establishing dataclasses "
 33s                 "are not being mixed. "
 33s                 "This can happen if a class that inherits from "
33s "'MappedAsDataclass', even indirectly, is been mapped with "
 33s                 "'@registry.mapped_as_dataclass'"
 33s             )
33s 33s # can't create a dataclass if __table__ is already there. This would 33s # fail an assertion when calling _get_arguments_for_make_dataclass: 33s # assert False, "Mapped[] received without a mapping declaration"
 33s         if "__table__" in self.cls.__dict__:
 33s >           raise exc.InvalidRequestError(
 33s                 f"Class {self.cls} already defines a '__table__'. "
33s "ORM Annotated Dataclasses do not support a pre-existing "
 33s                 "'__table__' element"
 33s             )
33s E sqlalchemy.exc.InvalidRequestError: Class <class 'test_model_bind.test_explicit_table.<locals>.User'> already defines a '__table__'. ORM Annotated Dataclasses do not support a pre-existing '__table__' element 33s 33s /usr/lib/python3/dist-packages/sqlalchemy/orm/decl_base.py:1074: InvalidRequestError 33s =============================== warnings summary ===============================
 33s tests/test_model.py: 20 warnings
33s /usr/lib/python3/dist-packages/sqlalchemy/sql/schema.py:3625: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
 33s     return util.wrap_callable(lambda ctx: fn(), fn)  # type: ignore
33s 33s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 33s =========================== short test summary info ============================ 33s FAILED tests/test_model_bind.py::test_explicit_table[db2] - sqlalchemy.exc.In... 33s FAILED tests/test_model_bind.py::test_explicit_table[db4] - sqlalchemy.exc.In... 33s ================== 2 failed, 450 passed, 20 warnings in 2.94s ==================
 34s autopkgtest [06:44:56]: test smoke

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to