<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/sqlalchemy.git/lib/sqlalchemy/ext/declarative, branch main</title>
<subtitle>github.com: zzzeek/sqlalchemy.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/'/>
<entry>
<title>implement polymorphic_abstract=True feature</title>
<updated>2023-01-14T21:45:01+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2023-01-13T22:24:14+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=e07130c597422d5f9a5d734e1411d8fef0c2deff'/>
<id>e07130c597422d5f9a5d734e1411d8fef0c2deff</id>
<content type='text'>
Added a new parameter to :class:`_orm.Mapper` called
:paramref:`_orm.Mapper.polymorphic_abstract`. The purpose of this directive
is so that the ORM will not consider the class to be instantiated or loaded
directly, only subclasses. The actual effect is that the
:class:`_orm.Mapper` will prevent direct instantiation of instances
of the class and will expect that the class does not have a distinct
polymorphic identity configured.

In practice, the class that is mapped with
:paramref:`_orm.Mapper.polymorphic_abstract` can be used as the target of a
:func:`_orm.relationship` as well as be used in queries; subclasses must of
course include polymorphic identities in their mappings.

The new parameter is automatically applied to classes that subclass
the :class:`.AbstractConcreteBase` class, as this class is not intended
to be instantiated.

Additionally, updated some areas of the single table inheritance
documentation to include mapped_column(nullable=False) for all
subclass-only columns; the mappings as given didn't work as the
columns were no longer nullable using Annotated Declarative Table
style.

Fixes: #9060
Change-Id: Ief0278e3945a33a6ff38ac14d39c38ce24910d7f
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Added a new parameter to :class:`_orm.Mapper` called
:paramref:`_orm.Mapper.polymorphic_abstract`. The purpose of this directive
is so that the ORM will not consider the class to be instantiated or loaded
directly, only subclasses. The actual effect is that the
:class:`_orm.Mapper` will prevent direct instantiation of instances
of the class and will expect that the class does not have a distinct
polymorphic identity configured.

In practice, the class that is mapped with
:paramref:`_orm.Mapper.polymorphic_abstract` can be used as the target of a
:func:`_orm.relationship` as well as be used in queries; subclasses must of
course include polymorphic identities in their mappings.

The new parameter is automatically applied to classes that subclass
the :class:`.AbstractConcreteBase` class, as this class is not intended
to be instantiated.

Additionally, updated some areas of the single table inheritance
documentation to include mapped_column(nullable=False) for all
subclass-only columns; the mappings as given didn't work as the
columns were no longer nullable using Annotated Declarative Table
style.

Fixes: #9060
Change-Id: Ief0278e3945a33a6ff38ac14d39c38ce24910d7f
</pre>
</div>
</content>
</entry>
<entry>
<title>happy new year 2023</title>
<updated>2023-01-03T17:45:52+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2023-01-03T17:45:52+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=5147bf8e3cb321b8728b3af5bb0b2644995b3793'/>
<id>5147bf8e3cb321b8728b3af5bb0b2644995b3793</id>
<content type='text'>
Change-Id: I625af65b3fb1815b1af17dc2ef47dd697fdc3fb1
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I625af65b3fb1815b1af17dc2ef47dd697fdc3fb1
</pre>
</div>
</content>
</entry>
<entry>
<title>reorganize Mapped[] super outside of MapperProperty</title>
<updated>2022-10-06T00:35:57+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2022-09-29T16:56:23+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=566cccc8645be99a23811c39d43481d7248628b0'/>
<id>566cccc8645be99a23811c39d43481d7248628b0</id>
<content type='text'>
We made all the MapperProperty classes a subclass
of Mapped[] to allow declarative mappings to name
Mapped[] on the left side.  this was cheating a bit because
MapperProperty is not actually a descriptor, and the mapping
process replaces the object with InstrumentedAttribute at
mapping time, which is the actual Mapped[] descriptor.

But now in I6929f3da6e441cad92285e7309030a9bac4e429d we
are considering making the "cheating" a little more extensive
by putting DynamicMapped / WriteOnlyMapped in Relationship's
hierarchy, which need a flat out "type: ignore" to work.

Instead of pushing more cheats into the core classes, move
out the "Declarative"-facing versions of these classes to be
typing only: Relationship, Composite, Synonym, and MappedSQLExpression
added for ColumnProperty.  Keep the internals expressed on the
old names, RelationshipProperty, CompositeProperty, SynonymProperty,
ColumnProprerty, which will remain "pure" with fully correct typing.
then have the typing only endpoints be where the "cheating"
and "type: ignores" have to happen, so that these are more or less
slightly better forms of "Any".

Change-Id: Ied7cc11196c9204da6851f49593d1b1fd2ef8ad8
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We made all the MapperProperty classes a subclass
of Mapped[] to allow declarative mappings to name
Mapped[] on the left side.  this was cheating a bit because
MapperProperty is not actually a descriptor, and the mapping
process replaces the object with InstrumentedAttribute at
mapping time, which is the actual Mapped[] descriptor.

But now in I6929f3da6e441cad92285e7309030a9bac4e429d we
are considering making the "cheating" a little more extensive
by putting DynamicMapped / WriteOnlyMapped in Relationship's
hierarchy, which need a flat out "type: ignore" to work.

Instead of pushing more cheats into the core classes, move
out the "Declarative"-facing versions of these classes to be
typing only: Relationship, Composite, Synonym, and MappedSQLExpression
added for ColumnProperty.  Keep the internals expressed on the
old names, RelationshipProperty, CompositeProperty, SynonymProperty,
ColumnProprerty, which will remain "pure" with fully correct typing.
then have the typing only endpoints be where the "cheating"
and "type: ignores" have to happen, so that these are more or less
slightly better forms of "Any".

Change-Id: Ied7cc11196c9204da6851f49593d1b1fd2ef8ad8
</pre>
</div>
</content>
</entry>
<entry>
<title>improve abstractconcretebase</title>
<updated>2022-08-18T17:47:14+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2022-08-17T21:47:19+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=d0abdbe247dc82db51aa0af3d31b051042a8ba87'/>
<id>d0abdbe247dc82db51aa0af3d31b051042a8ba87</id>
<content type='text'>
try to limit the attributes on the base and set up wpoly
etc so that things still work the way we want.

It seems like I've tried this in the past before so not sure
if this is actually working or if there are problems.   it needs
a little more strictness on how you set up your base since
attributes are no longer implicit.  So, it seems like perhaps
the new behavior should be on a flag or something like
"strict_attributes=True", something like that, so that nothing
breaks for existing users and we can slowly deal with the new
way being a little bit less worse than the old way.

Fixes: #8403
Change-Id: Ic9652d9a0b024d649807aaf3505e67173e7dc3b9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
try to limit the attributes on the base and set up wpoly
etc so that things still work the way we want.

It seems like I've tried this in the past before so not sure
if this is actually working or if there are problems.   it needs
a little more strictness on how you set up your base since
attributes are no longer implicit.  So, it seems like perhaps
the new behavior should be on a flag or something like
"strict_attributes=True", something like that, so that nothing
breaks for existing users and we can slowly deal with the new
way being a little bit less worse than the old way.

Fixes: #8403
Change-Id: Ic9652d9a0b024d649807aaf3505e67173e7dc3b9
</pre>
</div>
</content>
</entry>
<entry>
<title>more abstractconcretebase clarity</title>
<updated>2022-08-18T15:54:04+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2022-08-18T15:54:04+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=a47d76ca25275344345b208def5f72292e8687b4'/>
<id>a47d76ca25275344345b208def5f72292e8687b4</id>
<content type='text'>
Change-Id: I9ddb6b1a2e0c0be1fe355a7ea714d0e16aa93b47
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I9ddb6b1a2e0c0be1fe355a7ea714d0e16aa93b47
</pre>
</div>
</content>
</entry>
<entry>
<title>use metadata.reflect() for DeferredReflection</title>
<updated>2022-06-21T18:45:25+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2022-06-21T18:45:25+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=6cc063f4a217fd2c2831eb3a76a1fe237c42867f'/>
<id>6cc063f4a217fd2c2831eb3a76a1fe237c42867f</id>
<content type='text'>
as metadata.reflect() now has a signficant performance gain
over indivdual Table reflection, rework DeferredReflection
to use this

Fixes: #8155
Change-Id: I98d55fae83f0cf06a8ca8b89112c85655424d73a
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
as metadata.reflect() now has a signficant performance gain
over indivdual Table reflection, rework DeferredReflection
to use this

Fixes: #8155
Change-Id: I98d55fae83f0cf06a8ca8b89112c85655424d73a
</pre>
</div>
</content>
</entry>
<entry>
<title>rework ORM mapping docs</title>
<updated>2022-06-21T16:32:10+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2022-06-13T15:46:28+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=f9f1e8b6c5890eb17b6ba055ff563087cac20d0e'/>
<id>f9f1e8b6c5890eb17b6ba055ff563087cac20d0e</id>
<content type='text'>
prepare docs for newly incoming mapper styles, including
new dataclass mapping.   move the existing dataclass/attrs
docs all into their own section and try to improve organization
and wording into the relatively recent "mapping styles"
document.

Change-Id: I0b5e2a5b6a70db65ab19b5bb0a2bb7df20e0b498
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
prepare docs for newly incoming mapper styles, including
new dataclass mapping.   move the existing dataclass/attrs
docs all into their own section and try to improve organization
and wording into the relatively recent "mapping styles"
document.

Change-Id: I0b5e2a5b6a70db65ab19b5bb0a2bb7df20e0b498
</pre>
</div>
</content>
</entry>
<entry>
<title>revenge of pep 484</title>
<updated>2022-05-16T01:57:01+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2022-05-06T20:09:52+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=18a73fb1d1c267842ead5dacd05a49f4344d8b22'/>
<id>18a73fb1d1c267842ead5dacd05a49f4344d8b22</id>
<content type='text'>
trying to get remaining must-haves for ORM

Change-Id: I66a3ecbbb8e5ba37c818c8a92737b576ecf012f7
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
trying to get remaining must-haves for ORM

Change-Id: I66a3ecbbb8e5ba37c818c8a92737b576ecf012f7
</pre>
</div>
</content>
</entry>
<entry>
<title>inline mypy config; files ignoring type errors for the moment</title>
<updated>2022-04-28T19:02:50+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2022-04-27T19:43:02+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=f2bd4f513628bb2a7a8e8b36383e3a4324eac803'/>
<id>f2bd4f513628bb2a7a8e8b36383e3a4324eac803</id>
<content type='text'>
to simplify pyproject.toml change the remaining files
that aren't going to be typed on this first pass
(unless of course someone wants to type some of these)
to include # mypy: ignore-errors.   for the moment, only a handful
of ORM modules are to have more type checking implemented.

It's important that ignore-errors is used and
not "# type: ignore", as in the latter case, mypy doesn't even
read the existing types in the file, which makes it impossible to
type any files that refer to those modules at all.

to simplify ongoing typing work use inline mypy config
for remaining files that are "done" for now, indicating the
level of type checking they currently have.

Change-Id: I98669c1a305c2f0adba85d10b5425541f3fe9533
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
to simplify pyproject.toml change the remaining files
that aren't going to be typed on this first pass
(unless of course someone wants to type some of these)
to include # mypy: ignore-errors.   for the moment, only a handful
of ORM modules are to have more type checking implemented.

It's important that ignore-errors is used and
not "# type: ignore", as in the latter case, mypy doesn't even
read the existing types in the file, which makes it impossible to
type any files that refer to those modules at all.

to simplify ongoing typing work use inline mypy config
for remaining files that are "done" for now, indicating the
level of type checking they currently have.

Change-Id: I98669c1a305c2f0adba85d10b5425541f3fe9533
</pre>
</div>
</content>
</entry>
<entry>
<title>establish mypy / typing approach for v2.0</title>
<updated>2022-02-13T19:23:04+00:00</updated>
<author>
<name>Mike Bayer</name>
<email>mike_mp@zzzcomputing.com</email>
</author>
<published>2022-01-24T22:04:27+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/python-packages/sqlalchemy.git/commit/?id=e545298e35ea9f126054b337e4b5ba01988b29f7'/>
<id>e545298e35ea9f126054b337e4b5ba01988b29f7</id>
<content type='text'>
large patch to get ORM / typing efforts started.
this is to support adding new test cases to mypy,
support dropping sqlalchemy2-stubs entirely from the
test suite, validate major ORM typing reorganization
to eliminate the need for the mypy plugin.

* New declarative approach which uses annotation
  introspection, fixes: #7535
* Mapped[] is now at the base of all ORM constructs
  that find themselves in classes, to support direct
  typing without plugins
* Mypy plugin updated for new typing structures
* Mypy test suite broken out into "plugin" tests vs.
  "plain" tests, and enhanced to better support test
  structures where we assert that various objects are
  introspected by the type checker as we expect.
  as we go forward with typing, we will
  add new use cases to "plain" where we can assert that
  types are introspected as we expect.
* For typing support, users will be much more exposed to the
  class names of things.  Add these all to "sqlalchemy" import
  space.
* Column(ForeignKey()) no longer needs to be `@declared_attr`
  if the FK refers to a remote table
* composite() attributes mapped to a dataclass no longer
  need to implement a `__composite_values__()` method
* with_variant() accepts multiple dialect names

Change-Id: I22797c0be73a8fbbd2d6f5e0c0b7258b17fe145d
Fixes: #7535
Fixes: #7551
References: #6810
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
large patch to get ORM / typing efforts started.
this is to support adding new test cases to mypy,
support dropping sqlalchemy2-stubs entirely from the
test suite, validate major ORM typing reorganization
to eliminate the need for the mypy plugin.

* New declarative approach which uses annotation
  introspection, fixes: #7535
* Mapped[] is now at the base of all ORM constructs
  that find themselves in classes, to support direct
  typing without plugins
* Mypy plugin updated for new typing structures
* Mypy test suite broken out into "plugin" tests vs.
  "plain" tests, and enhanced to better support test
  structures where we assert that various objects are
  introspected by the type checker as we expect.
  as we go forward with typing, we will
  add new use cases to "plain" where we can assert that
  types are introspected as we expect.
* For typing support, users will be much more exposed to the
  class names of things.  Add these all to "sqlalchemy" import
  space.
* Column(ForeignKey()) no longer needs to be `@declared_attr`
  if the FK refers to a remote table
* composite() attributes mapped to a dataclass no longer
  need to implement a `__composite_values__()` method
* with_variant() accepts multiple dialect names

Change-Id: I22797c0be73a8fbbd2d6f5e0c0b7258b17fe145d
Fixes: #7535
Fixes: #7551
References: #6810
</pre>
</div>
</content>
</entry>
</feed>
