]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
some typing fixes
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Jun 2022 14:34:19 +0000 (10:34 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 3 Jun 2022 17:29:57 +0000 (13:29 -0400)
commit47eff8b9e35dec9305d22484c17dd6c0649a876a
tree83e806aab8759069b3d6847e063cb310f5bda74d
parentad86d32f7fbd1c6deda8ff3bebe0595c0f2986cc
some typing fixes

* ClassVar for decl fields, add __tablename__
* dataclasses require annotations for all fields.  For us,
  if no annotation, then skip that field as part of what is
  considered to be a "dataclass", as this matches the behavior
  of pyright right now.   We could alternatively raise on this
  use, which is what dataclasses does.   we should ask the pep
  people
* plain field that's just "str", "int", etc., with no value.
  Disallow it unless __allow_unmapped__ is set.   If field
  has dataclasses.field, Column, None, a value etc, it goes through,
  and when using dataclasses mixin all such fields are considered
  for the dataclass setup just like a dataclass.  Hopefully this
  does not have major backwards compat issues.  __allow_unmapped__
  can be set on the base class, mixins, etc., it's liberal for
  now in case people have this problem.
* accommodate for ClassVar, these are not considered at all for
  mapping.

Change-Id: Id743aa0456bade9a5d5832796caeecc3dc4accb7
lib/sqlalchemy/orm/decl_api.py
lib/sqlalchemy/orm/decl_base.py
lib/sqlalchemy/orm/util.py
test/orm/declarative/test_dc_transforms.py
test/orm/declarative/test_typed_mapping.py