]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
2 years ago- 2.0.5.post1 rel_2_0_5_post1
Mike Bayer [Mon, 6 Mar 2023 03:32:07 +0000 (22:32 -0500)] 
- 2.0.5.post1

2 years agoremove release date
Mike Bayer [Mon, 6 Mar 2023 03:31:24 +0000 (22:31 -0500)] 
remove release date

Change-Id: I8721674372673d0b242e1e07d3fc9b7ff7256c48

2 years agocomment out pickle/ process test and attempt 2.0.5.post1
Mike Bayer [Mon, 6 Mar 2023 03:25:46 +0000 (22:25 -0500)] 
comment out pickle/ process test and attempt 2.0.5.post1

if .post1 fails to work out, we'll just do 2.0.6

The test_pickle_rows_other_process test is failing during wheel
builds as it seems that the "subprocess" run is not using the
cython extensions, leading to a pickle mismatch between the
cythonized and the pure python version of a row.  comment
out this test and attempt to release as 2.0.5.post1 so that
wheels can build.

Fixes: #9429
Change-Id: I6e1e9f2b9c4ef8fa67a88ff86ebdacbeb02b90df

2 years agoVersion 2.0.6 placeholder
Mike Bayer [Mon, 6 Mar 2023 01:59:39 +0000 (20:59 -0500)] 
Version 2.0.6 placeholder

2 years ago- 2.0.5 rel_2_0_5
Mike Bayer [Mon, 6 Mar 2023 00:55:20 +0000 (19:55 -0500)] 
- 2.0.5

2 years ago(lots of) changelog updates for 2.0.5
Mike Bayer [Mon, 6 Mar 2023 00:54:30 +0000 (19:54 -0500)] 
(lots of) changelog updates for 2.0.5

Change-Id: Iea2ca2cd1eb44b4e9139f2bb6c3d6239f67aeb56

2 years agoMerge "KeyFuncDict regression fixes and dataclass fixes" into main
mike bayer [Mon, 6 Mar 2023 00:31:10 +0000 (00:31 +0000)] 
Merge "KeyFuncDict regression fixes and dataclass fixes" into main

2 years agoKeyFuncDict regression fixes and dataclass fixes
Mike Bayer [Sat, 4 Mar 2023 20:31:41 +0000 (15:31 -0500)] 
KeyFuncDict regression fixes and dataclass fixes

adapt None-key warning for non-mapped attributes

Fixed multiple regressions due to :ticket:`8372`, involving
:func:`_orm.attribute_mapped_collection` (now called
:func:`_orm.attribute_keyed_dict`).

First, the collection was no longer usable with "key" attributes that were
not themselves ordinary mapped attributes; attributes linked to descriptors
and/or association proxy attributes have been fixed.

Second, if an event or other operation needed access to the "key" in order
to populate the dictionary from an mapped attribute that was not
loaded, this also would raise an error inappropriately, rather than
trying to load the attribute as was the behavior in 1.4.  This is also
fixed.

For both cases, the behavior of :ticket:`8372` has been expanded.
:ticket:`8372` introduced an error that raises when the derived key that
would be used as a mapped dictionary key is effectively unassigned. In this
change, a warning only is emitted if the effective value of the ".key"
attribute is ``None``, where it cannot be unambiguously determined if this
``None`` was intentional or not. ``None`` will be not supported as mapped
collection dictionary keys going forward (as it typically refers to NULL
which means "unknown"). Setting
:paramref:`_orm.attribute_keyed_dict.ignore_unpopulated_attribute` will now
cause such ``None`` keys to be ignored as well.

Add value constructors to dictionary collections

Added constructor arguments to the built-in mapping collection types
including :class:`.KeyFuncDict`, :func:`_orm.attribute_keyed_dict`,
:func:`_orm.column_keyed_dict` so that these dictionary types may be
constructed in place given the data up front; this provides further
compatibility with tools such as Python dataclasses ``.asdict()`` which
relies upon invoking these classes directly as ordinary dictionary classes.

Fixes: #9418
Fixes: #9424
Change-Id: Ib16c4e690b7ac3fcc34df2f139cad61c6c4b2b19

2 years agoMerge "Fixed bug where :meth:`_engine.Row`s could not be unpickled by other processes...
mike bayer [Sun, 5 Mar 2023 20:33:46 +0000 (20:33 +0000)] 
Merge "Fixed bug where :meth:`_engine.Row`s could not be unpickled by other processes." into main

2 years agoMerge "audition pymssql once more; retire sane_rowcount_returning" into main
mike bayer [Sun, 5 Mar 2023 20:29:27 +0000 (20:29 +0000)] 
Merge "audition pymssql once more; retire sane_rowcount_returning" into main

2 years agoMerge "ensure event handlers called for all do_ping" into main
mike bayer [Sun, 5 Mar 2023 20:23:20 +0000 (20:23 +0000)] 
Merge "ensure event handlers called for all do_ping" into main

2 years agoaudition pymssql once more; retire sane_rowcount_returning
Mike Bayer [Fri, 3 Mar 2023 14:30:58 +0000 (09:30 -0500)] 
audition pymssql once more; retire sane_rowcount_returning

pymssql seems to be maintained again and seems to be working
completely, so let's try re-enabling it.

Fixed issue in the new :class:`.Uuid` datatype which prevented it from
working with the pymssql driver. As pymssql seems to be maintained again,
restored testing support for pymssql.

Tweaked the pymssql dialect to take better advantage of
RETURNING for INSERT statements in order to retrieve last inserted primary
key values, in the same way as occurs for the mssql+pyodbc dialect right
now.

Identified that the ``sqlite`` and ``mssql+pyodbc`` dialects are now
compatible with the SQLAlchemy ORM's "versioned rows" feature, since
SQLAlchemy now computes rowcount for a RETURNING statement in this specific
case by counting the rows returned, rather than relying upon
``cursor.rowcount``.  In particular, the ORM versioned rows use case
(documented at :ref:`mapper_version_counter`) should now be fully
supported with the SQL Server pyodbc dialect.

Change-Id: I38a0666587212327aecf8f98e86031ab25d1f14d
References: #5321
Fixes: #9414
2 years agoFixed bug where :meth:`_engine.Row`s could not be
Federico Caselli [Sat, 4 Mar 2023 22:33:02 +0000 (23:33 +0100)] 
Fixed bug where :meth:`_engine.Row`s could not be
unpickled by other processes.

Fixes: #9423
Change-Id: Ie496e31158caff5f72e0a9069dddd55f3116e0b8

2 years agoMerge "restore old *args approach for MutableDict.pop()" into main
mike bayer [Sat, 4 Mar 2023 20:42:35 +0000 (20:42 +0000)] 
Merge "restore old *args approach for MutableDict.pop()" into main

2 years agoMerge "Restore connectivity with ancient sqlite" into main
mike bayer [Sat, 4 Mar 2023 20:42:26 +0000 (20:42 +0000)] 
Merge "Restore connectivity with ancient sqlite" into main

2 years agoFix the count example in ORM migration doc (#9421)
Grey Li [Sat, 4 Mar 2023 17:51:50 +0000 (01:51 +0800)] 
Fix the count example in ORM migration doc (#9421)

2 years agoMerge "TextualSelect is ReturnsRowsRole" into main
mike bayer [Sat, 4 Mar 2023 16:32:17 +0000 (16:32 +0000)] 
Merge "TextualSelect is ReturnsRowsRole" into main

2 years agoMerge "Add missing overload to Numeric" into main
mike bayer [Sat, 4 Mar 2023 16:31:18 +0000 (16:31 +0000)] 
Merge "Add missing overload to Numeric" into main

2 years agoRestore connectivity with ancient sqlite
Federico Caselli [Mon, 27 Feb 2023 21:05:08 +0000 (22:05 +0100)] 
Restore connectivity with ancient sqlite

Fixed bug that prevented SQLAlchemy to connect when using a very old
sqlite version (before 3.9) on python 3.8+.

Fixes: #9379
Change-Id: I10ca347398221c952e1a572dc6ef80e491d1f5cf

2 years agoMerge "allow multiparams with scalars" into main
mike bayer [Sat, 4 Mar 2023 16:11:17 +0000 (16:11 +0000)] 
Merge "allow multiparams with scalars" into main

2 years agorestore old *args approach for MutableDict.pop()
Nils Philippsen [Tue, 28 Feb 2023 21:04:54 +0000 (16:04 -0500)] 
restore old *args approach for MutableDict.pop()

The typing change in ba0e508141206efc55cdab91df21c1
changed the semantics of pop() and possibly setdefault() in order to
try working at runtime with a two-argument signature.  however
the implementation for this in cpython likely uses a strict `*args`
approach where the lack of the second parameter is explicit, rather
than matching to a constant.  Restore the old implementation inside
of a "not TYPE_CHECKING" block while keeping the type annotated forms
intact for typing only.

Fixed regression caused by typing added to ``sqlalchemy.ext.mutable`` for
:ticket:`8667`, where the semantics of the ``.pop()`` method changed such
that the method was non-working.  Pull request courtesy Nils Philippsen.

Fixes: #9380
Closes: #9381
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9381
Pull-request-sha: fd903ce1b949d2af26ceb6c2159ad84aab007f3d

Change-Id: I213e52f51a795801aacf05307e38cc8c89b54e12

2 years agoMerge "Validate metadata schema arg" into main
mike bayer [Sat, 4 Mar 2023 16:06:50 +0000 (16:06 +0000)] 
Merge "Validate metadata schema arg" into main

2 years agoensure event handlers called for all do_ping
Mike Bayer [Fri, 24 Feb 2023 21:15:21 +0000 (16:15 -0500)] 
ensure event handlers called for all do_ping

The support for pool ping listeners to receive exception events via the
:meth:`.ConnectionEvents.handle_error` event added in 2.0.0b1 for
:ticket:`5648` failed to take into account dialect-specific ping routines
such as that of MySQL and PostgreSQL. The dialect feature has been reworked
so that all dialects participate within event handling.   Additionally,
a new boolean element :attr:`.ExceptionContext.is_pre_ping` is added
which identifies if this operation is occurring within the pre-ping
operation.

For this release, third party dialects which implement a custom
:meth:`_engine.Dialect.do_ping` method can opt in to the newly improved
behavior by having their method no longer catch exceptions or check
exceptions for "is_disconnect", instead just propagating all exceptions
outwards. Checking the exception for "is_disconnect" is now done by an
enclosing method on the default dialect, which ensures that the event hook
is invoked for all exception scenarios before testing the exception as a
"disconnect" exception. If an existing ``do_ping()`` method continues to
catch exceptions and check "is_disconnect", it will continue to work as it
did previously, but ``handle_error`` hooks will not have access to the
exception if it isn't propagated outwards.

Fixes: #5648
Change-Id: I6535d5cb389e1a761aad8c37cfeb332c548b876d

2 years agoRemove duplicate word in tutorial (#9420)
Viicos [Fri, 3 Mar 2023 21:46:49 +0000 (22:46 +0100)] 
Remove duplicate word in tutorial (#9420)

2 years agoAdd missing overload to Numeric
Federico Caselli [Tue, 28 Feb 2023 21:44:27 +0000 (22:44 +0100)] 
Add missing overload to Numeric

Added missing init overload to :class:`_sql.Numeric` to allow
type checkers to properly resolve the type var given the
``asdecimal`` parameter.

this fortunately fixes a glitch in the generate_sql_functions script
also

Fixes: #9391
Change-Id: I9cecc40c52711489e9dbe663f110c3b81c7285e4

2 years agoTextualSelect is ReturnsRowsRole
Mike Bayer [Wed, 1 Mar 2023 16:07:25 +0000 (11:07 -0500)] 
TextualSelect is ReturnsRowsRole

Fixed typing bug where :meth:`_sql.Select.from_statement` would not accept
:func:`_sql.text` or :class:`.TextualSelect` objects as a valid type.
Additionally repaired the :class:`.TextClause.columns` method to have a
return type, which was missing.

Fixes: #9398
Change-Id: I627fc33bf83365e1c7f7c6ed29ea387dfd4a57d8

2 years agoallow multiparams with scalars
Mike Bayer [Thu, 2 Mar 2023 01:44:49 +0000 (20:44 -0500)] 
allow multiparams with scalars

Fixed bug where the :meth:`_engine.Connection.scalars` method was not typed
as allowing a multiple-parameters list, which is now supported using
insertmanyvalues operations.

Change-Id: I65e22c3bee80fc226d484ff1424421dd78520fa5

2 years agoFixed issue when copying ExcludeConstraint
Federico Caselli [Wed, 1 Mar 2023 22:22:46 +0000 (23:22 +0100)] 
Fixed issue when copying ExcludeConstraint

Fixes: #9401
Change-Id: Ie10192348749567110f53ae618fc724f37d1a6a1

2 years agoFix Typo In Tutorial (#9399)
easy_markie_tee [Wed, 1 Mar 2023 21:51:43 +0000 (16:51 -0500)] 
Fix Typo In Tutorial (#9399)

Missing a word on the page `Working with Database Metadata`.
First paragraph under section 'Setting up MetaData with Table objects'.
"...the database which we query from is know [as] a table."

Co-authored-by: markie tee <cassette.head@gmail.com>
2 years agoValidate metadata schema arg
Federico Caselli [Tue, 28 Feb 2023 22:14:05 +0000 (23:14 +0100)] 
Validate metadata schema arg

Validate that when provided the :paramref:`_sql.MetaData.schema`
argument of :class:`_sql.MetaData` is a string.

Change-Id: I4237232d2ee0f5a4d0b9dbd9af5f5b57abf395b4

2 years agoMerge "Restore export for nullslast/nullfirst" into main
mike bayer [Wed, 1 Mar 2023 02:06:23 +0000 (02:06 +0000)] 
Merge "Restore export for nullslast/nullfirst" into main

2 years agoRestore export for nullslast/nullfirst
Federico Caselli [Mon, 27 Feb 2023 21:56:02 +0000 (22:56 +0100)] 
Restore export for nullslast/nullfirst

Previously only the snake case versions nulls_last/nulls_first
were exported in the toplevel namespace.

Fixes: #9390
Change-Id: I9088e858ae108a5c9106b9d8d82655ad605417cc

2 years agoMerge "Improve orm event docs" into main
mike bayer [Tue, 28 Feb 2023 21:57:12 +0000 (21:57 +0000)] 
Merge "Improve orm event docs" into main

2 years agoensure single import per line
Mike Bayer [Tue, 28 Feb 2023 16:05:48 +0000 (11:05 -0500)] 
ensure single import per line

This adds the very small plugin flake8-import-single which
will prevent us from having an import with more than one symbol
on a line.

Flake8 by itself prevents this pattern with E401:

import collections, os, sys

However does not do anything with this:

from sqlalchemy import Column, text

Both statements have the same issues generating merge artifacts
as well as presenting a manual decision to be made.   While
zimports generally cleans up such imports at the top level, we
don't enforce zimports / pre-commit use.

the plugin finds the same issue for imports that are inside of
test methods.   We shouldn't usually have imports in test methods
so most of them here are moved to be top level.

The version is pinned at 0.1.5; the project seems to have no
activity since 2019, however there are three 0.1.6dev releases
on pypi which stopped in September 2019, they seem to be
experiments with packaging.  The source for 0.1.5
is extremely simple and only reveals one method to flake8
(the run() method).

Change-Id: Icea894e43bad9c0b5d4feb5f49c6c666d6ea6aa1

2 years agoImprove orm event docs
Federico Caselli [Fri, 24 Feb 2023 22:24:03 +0000 (23:24 +0100)] 
Improve orm event docs

Change-Id: Ia4f8ce497565c9d5e8df4ef7cc3c3e645f995ff3

2 years agoImprove exclude constraint docs and tests.
Federico Caselli [Mon, 27 Feb 2023 21:47:19 +0000 (22:47 +0100)] 
Improve exclude constraint docs and tests.

Follow up of 71693c94d52612a5e88128575ff308ee4a923c00

Change-Id: Icc9d9942bda92171581dec82cf0cacbd3e3e4162

2 years agoMerge "Add separate version notes for scalars" into main
mike bayer [Mon, 27 Feb 2023 19:13:23 +0000 (19:13 +0000)] 
Merge "Add separate version notes for scalars" into main

2 years agoMerge "include columns from superclasses that indicate "selectin"" into main
mike bayer [Mon, 27 Feb 2023 15:30:35 +0000 (15:30 +0000)] 
Merge "include columns from superclasses that indicate "selectin"" into main

2 years agoMerge "fix with_polymorphic" into main
mike bayer [Mon, 27 Feb 2023 15:28:28 +0000 (15:28 +0000)] 
Merge "fix with_polymorphic" into main

2 years agoremove reveal_type import
Mike Bayer [Mon, 27 Feb 2023 13:29:45 +0000 (08:29 -0500)] 
remove reveal_type import

this is not really a thing until python 3.11

Change-Id: I4807fb01b718aa1b76dd70c561143acb22ff7b6c

2 years agoMerge "Create public QueryPropertyDescriptor type for query_property" into main
mike bayer [Mon, 27 Feb 2023 06:36:41 +0000 (06:36 +0000)] 
Merge "Create public QueryPropertyDescriptor type for query_property" into main

2 years agoinclude columns from superclasses that indicate "selectin"
Mike Bayer [Sun, 26 Feb 2023 14:31:36 +0000 (09:31 -0500)] 
include columns from superclasses that indicate "selectin"

Added support for the :paramref:`_orm.Mapper.polymorphic_load` parameter to
be applied to each mapper in an inheritance hierarchy more than one level
deep, allowing columns to load for all classes in the hierarchy that
indicate ``"selectin"`` using a single statement, rather than ignoring
elements on those intermediary classes that nonetheless indicate they also
would participate in ``"selectin"`` loading and were not part of the
base-most SELECT statement.

Fixes: #9373
Change-Id: If8dcba0f0191f6c2818ecd15870bccfdf5ce1112

2 years agoMerge "Declare KEY_OBJECTS_ONLY as cdef variable" into main
mike bayer [Mon, 27 Feb 2023 06:16:36 +0000 (06:16 +0000)] 
Merge "Declare KEY_OBJECTS_ONLY as cdef variable" into main

2 years agoMerge "apply a fixed locals w/ Mapped to all de-stringify" into main
mike bayer [Mon, 27 Feb 2023 06:15:58 +0000 (06:15 +0000)] 
Merge "apply a fixed locals w/ Mapped to all de-stringify" into main

2 years agoMerge "use read-only Mapping for values dictionary type" into main
mike bayer [Mon, 27 Feb 2023 06:10:26 +0000 (06:10 +0000)] 
Merge "use read-only Mapping for values dictionary type" into main

2 years agoMerge "locate automap base in hierarchy directly" into main
mike bayer [Mon, 27 Feb 2023 04:26:48 +0000 (04:26 +0000)] 
Merge "locate automap base in hierarchy directly" into main

2 years agofix with_polymorphic
Mike Bayer [Tue, 21 Feb 2023 16:06:17 +0000 (11:06 -0500)] 
fix with_polymorphic

Fixed typing issue where :func:`_orm.with_polymorphic` would not record the
class type correctly.

Fixes: #9340
Change-Id: I535ad9aede9b60475231028adb8dc270e55738a4

2 years agoMerge "ExcludeConstraint literal_compile" into main
mike bayer [Mon, 27 Feb 2023 04:22:37 +0000 (04:22 +0000)] 
Merge "ExcludeConstraint literal_compile" into main

2 years agoAdd separate version notes for scalars
Grey Li [Sun, 26 Feb 2023 10:56:37 +0000 (05:56 -0500)] 
Add separate version notes for scalars

Add separate 1.4.24 and 1.4.26 version notes for the .scalars method;
this covers Session, scoped_session, AsyncSession, async_scoped_session
as the "scoped" versions did not have the method added until 1.4.26
as part of :ticket:`7103`.

Also indicate scoped_session as ``sqlalchemy.orm.scoped_session`` in
docs rather than ``sqlalchemy.orm.scoping.scoped_session``.  This is
also happening in I77da54891860095edcb1f0625ead99fee89bd76f separately,
as both changesets refer to scoped_session without using ".scoping".

References: #7103
Closes: #9371
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9371
Pull-request-sha: 61132230cc6e897ab61beff25d98b19a4c0aefd0

Change-Id: I84c8b1aad752db124cfee6bc8516f6eed7ba2faf

2 years agoCreate public QueryPropertyDescriptor type for query_property
Federico Caselli [Tue, 21 Feb 2023 20:05:25 +0000 (21:05 +0100)] 
Create public QueryPropertyDescriptor type for query_property

Exported the type returned by :meth:`_orm.scoped_session.query_property`
using a new public type :class:`.orm.QueryPropertyDescriptor`.

Also stated ``scoped_session()`` from ``sqlalchemy.orm`` in the
documentation rather than from ``sqlalchemy.orm.scoping``.

Fixes: #9338
Change-Id: I77da54891860095edcb1f0625ead99fee89bd76f

2 years agoDeclare KEY_OBJECTS_ONLY as cdef variable
Matus Valo [Sun, 26 Feb 2023 20:10:23 +0000 (15:10 -0500)] 
Declare KEY_OBJECTS_ONLY as cdef variable

A small optimization to the Cython implementation of :class:`.ResultProxy`
using a cdef for a particular int value to avoid Python overhead. Pull
request courtesy Matus Valo.

Fixes: #9343
Closes: #9344
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9344
Pull-request-sha: fc6a97debe45497ef502f3861611b021a5885b63

Change-Id: I231d4fb292decfe9bccdf54f2851ce6f69d5d6c7

2 years agoapply a fixed locals w/ Mapped to all de-stringify
Mike Bayer [Tue, 21 Feb 2023 15:34:01 +0000 (10:34 -0500)] 
apply a fixed locals w/ Mapped to all de-stringify

Continued the fix for :ticket:`8853`, allowing the :class:`_orm.Mapped`
name to be fully qualified regardless of whether or not
``from __annotations__ import future`` were present. This issue first fixed
in 2.0.0b3 confirmed that this case worked via the test suite, however the
test suite apparently was not testing the behavior for the name ``Mapped``
not being locally present at all; string resolution has been updated to
ensure the ``Mapped`` symbol is locatable as applies to how the ORM uses
these functions.

Fixes: #8853
Fixes: #9335
Change-Id: Id82d09aee906165a4d77c7da6a0b4177dd675c10

2 years agouse read-only Mapping for values dictionary type
Mike Bayer [Sun, 26 Feb 2023 20:34:57 +0000 (15:34 -0500)] 
use read-only Mapping for values dictionary type

Improved typing for the mapping passed to :meth:`.UpdateBase.values` to be
more open-ended about collection type, by indicating read-only ``Mapping``
instead of writeable ``Dict``, the latter of which would error out under
typing tools on too limited of a key type.

Fixes: #9376
Change-Id: Ib7fdbba05ca7e1082409e1b5616e6a010262f032

2 years agoupdate case statement to v2 syntax
Federico Caselli [Fri, 24 Feb 2023 20:32:46 +0000 (21:32 +0100)] 
update case statement to v2 syntax

Change-Id: If278ea170e0a17b1e8ace2d470fb2fbdb7a6e9c1
References: #9370
References: #9365

2 years agolocate automap base in hierarchy directly
Mike Bayer [Fri, 24 Feb 2023 15:58:25 +0000 (10:58 -0500)] 
locate automap base in hierarchy directly

Fixed issue in automap where calling ``.prepare()`` from one of the mapped
classes would not use the correct base class when automap detected new
tables, instead using the given class, leading to mappers trying to
configure inheritance. While one should normally call ``.prepare()`` from
the base in any case, it shouldn't misbehave that badly when called from a
subclass.

Fixes: #9367
Change-Id: I705d4d939d45af52bc58a74e65994205ab791634

2 years agouse Column for legacy dataclasses mapping
Mike Bayer [Fri, 24 Feb 2023 04:52:31 +0000 (23:52 -0500)] 
use Column for legacy dataclasses mapping

Fixes: #9361
Change-Id: I9c433960664aa2b75cd03925d9dcf2e1ff27d8ce

2 years agoExcludeConstraint literal_compile
Federico Caselli [Wed, 22 Feb 2023 20:57:19 +0000 (21:57 +0100)] 
ExcludeConstraint literal_compile

ExcludeConstraint correctly uses literal compile
when compiling expression ddl.

Fixes: #9349
Change-Id: I11a994ac46556a972afc696a2baad7ddbdd3de97

2 years agoadd notes to all mapper flush events that these are only for flush
Mike Bayer [Tue, 21 Feb 2023 16:00:03 +0000 (11:00 -0500)] 
add notes to all mapper flush events that these are only for flush

Fixes: #9339
Change-Id: I44542166417776733245e2ba39cd5de89b6d748b

2 years agoFix the docstring of AppenerQuery.append() (#9336)
Grey Li [Mon, 20 Feb 2023 20:05:09 +0000 (04:05 +0800)] 
Fix the docstring of AppenerQuery.append() (#9336)

2 years agoFix a syntax error in `AsyncConnection.stream_scalars()` example. (#9334)
Vytautas Liuolia [Sun, 19 Feb 2023 16:47:33 +0000 (17:47 +0100)] 
Fix a syntax error in `AsyncConnection.stream_scalars()` example. (#9334)

2 years agoUpdate dialect documentation about CrateDB (#9322)
Andreas Motl [Sun, 19 Feb 2023 16:47:02 +0000 (08:47 -0800)] 
Update dialect documentation about CrateDB (#9322)

The `crate-0.30.0` package offers compatibility with SQLAlchemy 2.0.

2 years agoFix grammatical error in intro.rst (#9316)
Maxwell D. Dorliea [Sun, 19 Feb 2023 16:46:42 +0000 (16:46 +0000)] 
Fix grammatical error in intro.rst (#9316)

2 years agoconsider column.name directly when evaluating use_existing_column
Mike Bayer [Sat, 18 Feb 2023 14:10:20 +0000 (09:10 -0500)] 
consider column.name directly when evaluating use_existing_column

Fixed issue where new :paramref:`_orm.mapped_column.use_existing_column`
feature would not work if the two same-named columns were mapped under
attribute names that were differently-named from the explicit name given to
the column itself. The attribute names can now be differently named when
using this parameter.

Fixes: #9332
Change-Id: I43716b8ca2b089e54a2b078db28b6c4770468bdd

2 years agofix sphinx command got stuck in output
Mike Bayer [Fri, 17 Feb 2023 18:00:48 +0000 (13:00 -0500)] 
fix sphinx command got stuck in output

Change-Id: Idf68d2c5e40a3b072ad1cd479638f9eb364ba15f

2 years agomore edits
Mike Bayer [Fri, 17 Feb 2023 16:25:16 +0000 (11:25 -0500)] 
more edits

I can only see issues in the docs when they're live on the
site, sorry

Change-Id: I948b7c8e37657ca85d02843211cbfdb03aa5da75

2 years agotypo, captions
Mike Bayer [Fri, 17 Feb 2023 16:23:41 +0000 (11:23 -0500)] 
typo, captions

Change-Id: I547e66b60f5a7b2901a76ebc59469bce018e05ff

2 years agoVersion 2.0.5 placeholder
Mike Bayer [Fri, 17 Feb 2023 16:01:43 +0000 (11:01 -0500)] 
Version 2.0.5 placeholder

2 years ago- 2.0.4 rel_2_0_4
Mike Bayer [Fri, 17 Feb 2023 15:47:40 +0000 (10:47 -0500)] 
- 2.0.4

2 years agochangelog updates
Mike Bayer [Fri, 17 Feb 2023 15:47:00 +0000 (10:47 -0500)] 
changelog updates

Change-Id: Id28c5ae101cf462609740a698a1b188cce01bc5a

2 years agorework hybrid docs further
Mike Bayer [Fri, 17 Feb 2023 15:24:32 +0000 (10:24 -0500)] 
rework hybrid docs further

we have a very complicated story to tell and we need to
keep it within "reference doc" mode as much as we can

Change-Id: I873b7d95aea7b5a1d04de0c78a4e88651c908b35

2 years agoAllow custom sorting of column in the ORM.
Federico Caselli [Thu, 16 Feb 2023 20:52:18 +0000 (21:52 +0100)] 
Allow custom sorting of column in the ORM.

To accommodate a change in column ordering used by ORM Declarative in
SQLAlchemy 2.0, a new parameter :paramref:`_orm.mapped_column.sort_order`
has been added that can be used to control the order of the columns defined
in the table by the ORM, for common use cases such as mixins with primary
key columns that should appear first in tables. The change notes at
:ref:`change_9297` illustrate the default change in ordering behavior
(which is part of all SQLAlchemy 2.0 releases) as well as use of the
:paramref:`_orm.mapped_column.sort_order` to control column ordering when
using mixins and multiple classes (new in 2.0.4).

Fixes: #9297
Change-Id: Ic7163d64efdc0eccb53d6ae0dd89ec83427fb675

2 years agoMerge "modernize hybrids and apply typing" into main
mike bayer [Fri, 17 Feb 2023 00:20:00 +0000 (00:20 +0000)] 
Merge "modernize hybrids and apply typing" into main

2 years agomodernize hybrids and apply typing
Mike Bayer [Thu, 16 Feb 2023 14:39:07 +0000 (09:39 -0500)] 
modernize hybrids and apply typing

Improved the typing support for the :ref:`hybrids_toplevel`
extension, updated all documentation to use ORM Annotated Declarative
mappings, and added a new modifier called :attr:`.hybrid_property.inplace`.
This modifier provides a way to alter the state of a :class:`.hybrid_property`
**in place**, which is essentially what very early versions of hybrids
did, before SQLAlchemy version 1.2.0 :ticket:`3912` changed this to
remove in-place mutation.  This in-place mutation is now restored on an
**opt-in** basis to allow a single hybrid to have multiple methods
set up, without the need to name all the methods the same and without the
need to carefully "chain" differently-named methods in order to maintain
the composition.  Typing tools such as Mypy and Pyright do not allow
same-named methods on a class, so with this change a succinct method
of setting up hybrids with typing support is restored.

Change-Id: Iea88025f023428f9f006846d09fbb4be391f5ebb
References: #9321

2 years agoMerge "Fix coercion issue for tuple bindparams" into main
mike bayer [Thu, 16 Feb 2023 19:57:50 +0000 (19:57 +0000)] 
Merge "Fix coercion issue for tuple bindparams" into main

2 years agoFix coercion issue for tuple bindparams
mike bayer [Wed, 15 Feb 2023 22:20:06 +0000 (23:20 +0100)] 
Fix coercion issue for tuple bindparams

Fixed issue where element types of a tuple value would be hardcoded to take
on the types from a compared-to tuple, when the comparison were using the
:meth:`.ColumnOperators.in_` operator. This was inconsistent with the usual
way that types are determined for a binary expression, which is that the
actual element type on the right side is considered first before applying
the left-hand-side type.

Fixes: #9313
Change-Id: Ia8874c09682a6512fcf4084cf14481024959c461

2 years agoMerge "rename EvaluatorCompiler to _EvaluatorCompiler" into main
mike bayer [Thu, 16 Feb 2023 02:38:47 +0000 (02:38 +0000)] 
Merge "rename EvaluatorCompiler to _EvaluatorCompiler" into main

2 years agoMerge "add dataclasses callable and apply annotations more strictly" into main
mike bayer [Thu, 16 Feb 2023 02:37:52 +0000 (02:37 +0000)] 
Merge "add dataclasses callable and apply annotations more strictly" into main

2 years agoimmediateload lazy relationships named in refresh.attribute_names
Mike Bayer [Mon, 13 Feb 2023 16:17:09 +0000 (11:17 -0500)] 
immediateload lazy relationships named in refresh.attribute_names

The :meth:`_orm.Session.refresh` method will now immediately load a
relationship-bound attribute that is explicitly named within the
:paramref:`_orm.Session.refresh.attribute_names` collection even if it is
currently linked to the "select" loader, which normally is a "lazy" loader
that does not fire off during a refresh. The "lazy loader" strategy will
now detect that the operation is specifically a user-initiated
:meth:`_orm.Session.refresh` operation which named this attribute
explicitly, and will then call upon the "immediateload" strategy to
actually emit SQL to load the attribute. This should be helpful in
particular for some asyncio situations where the loading of an unloaded
lazy-loaded attribute must be forced, without using the actual lazy-loading
attribute pattern not supported in asyncio.

Fixes: #9298
Change-Id: I9b50f339bdf06cdb2ec98f8e5efca2b690895dd7

2 years agoadd dataclasses callable and apply annotations more strictly
Mike Bayer [Fri, 10 Feb 2023 21:06:23 +0000 (16:06 -0500)] 
add dataclasses callable and apply annotations more strictly

Added new parameter ``dataclasses_callable`` to both the
:class:`_orm.MappedAsDataclass` class as well as the
:meth:`_orm.registry.mapped_as_dataclass` method which allows an
alternative callable to Python ``dataclasses.dataclass`` to be used in
order to produce dataclasses. The use case here is to drop in Pydantic's
dataclass function instead. Adjustments have been made to the mixin support
added for :ticket:`9179` in version 2.0.1 so that the ``__annotations__``
collection of the mixin is rewritten to not include the
:class:`_orm.Mapped` container, in the same way as occurs with mapped
classes, so that the Pydantic dataclasses constructor is not exposed to
unknown types.

Fixes: #9266
Change-Id: Ia0fab6f20b93a5cb853799dcf1b70a0386837c14

2 years agorename EvaluatorCompiler to _EvaluatorCompiler
Mike Bayer [Mon, 13 Feb 2023 17:31:44 +0000 (12:31 -0500)] 
rename EvaluatorCompiler to _EvaluatorCompiler

This is a private class, mark as such as some users
may have used this class directly in end-user code.

Change-Id: I2657eff1f9f11b59c0483922ac67d6420a082906
References: #9299

2 years agoprevent float tests from running on asyncmy
Mike Bayer [Wed, 15 Feb 2023 23:28:12 +0000 (18:28 -0500)] 
prevent float tests from running on asyncmy

asyncmy 0.2.7 has had a loss in float precision for even
very low numbers of significant digits.

Change-Id: Iec6d2650943eeaa8e854f21990f6565d73331f8c
References: https://github.com/long2ice/asyncmy/issues/56

2 years agomention mypy>=1 is required to type check the library
Federico Caselli [Wed, 15 Feb 2023 19:35:41 +0000 (20:35 +0100)] 
mention mypy>=1 is required to type check the library

Change-Id: Ie514c76b4f6b3241bba5083219a3eae19c2b7aae

2 years agoMerge "Improve ``oracledb`` thick mode flag." into main
mike bayer [Wed, 15 Feb 2023 18:21:31 +0000 (18:21 +0000)] 
Merge "Improve ``oracledb`` thick mode flag." into main

2 years agoMerge "Add ``Table.autoincrement_column``" into main
mike bayer [Wed, 15 Feb 2023 18:19:18 +0000 (18:19 +0000)] 
Merge "Add ``Table.autoincrement_column``" into main

2 years agoMerge "test dataclasses.KW_ONLY" into main
mike bayer [Wed, 15 Feb 2023 14:20:42 +0000 (14:20 +0000)] 
Merge "test dataclasses.KW_ONLY" into main

2 years agoImprove ``oracledb`` thick mode flag.
Federico Caselli [Mon, 13 Feb 2023 21:35:09 +0000 (22:35 +0100)] 
Improve ``oracledb`` thick mode flag.

Adjusted ``oracledb`` thick mode flag to make ``thick_mode=False`` not
enable thick mode. Previously only ``None`` was accepted as off value.

Fixes: #9295
Change-Id: I1a8397c19d065dfc2dda597e719922fc8d31acb1

2 years agofix typo in whatsnew (#9303)
Andrei Pozolotin [Tue, 14 Feb 2023 20:34:18 +0000 (14:34 -0600)] 
fix typo in whatsnew (#9303)

see #9294

2 years agoAdd ``Table.autoincrement_column``
Federico Caselli [Fri, 10 Feb 2023 20:37:20 +0000 (21:37 +0100)] 
Add ``Table.autoincrement_column``

Added public property :attr:`_sql.Table.autoincrement_column` that
returns the column identified as autoincrementing in the column.

Fixes: #9277
Change-Id: If60d6f92e0df94f57d00ff6d89d285c61b02f5a4

2 years agofix typo "Annotation" -> "Annotated" and use typing_extensions
Mike Bayer [Tue, 14 Feb 2023 16:13:43 +0000 (11:13 -0500)] 
fix typo "Annotation" -> "Annotated" and use typing_extensions

Fixes: #9305
Change-Id: I9f0ab24f609f6f557b5780209a85f0abe82b363e

2 years agotest dataclasses.KW_ONLY
Mike Bayer [Tue, 14 Feb 2023 14:09:15 +0000 (09:09 -0500)] 
test dataclasses.KW_ONLY

had no test support for this, seems to work.  gets
grabbed in annotations and applied correctly.

Change-Id: I2cd7ad7b376f38f945d2007b316a1316271f9a0f

2 years agofix documentation formatting
Federico Caselli [Mon, 13 Feb 2023 19:16:45 +0000 (20:16 +0100)] 
fix documentation formatting

Change-Id: I3307e1844237b58486dcce334eab80689e116bb8

2 years agocompletely lift-and-copy and_ / or_ documentation
Mike Bayer [Mon, 13 Feb 2023 17:23:28 +0000 (12:23 -0500)] 
completely lift-and-copy and_ / or_ documentation

Sphinx refuses to write the correct docstring for these without
placing a completely literal string with no interpolation of
any kind.   Current site has blank for these.

Change-Id: Ie19a0b89d05b45509708585e6efca1a35f30adb5

2 years agonote column ordering change, indicate recipe to control ordering
Mike Bayer [Mon, 13 Feb 2023 15:08:52 +0000 (10:08 -0500)] 
note column ordering change, indicate recipe to control ordering

Change-Id: I520c18ac8c84923558e2042265943b6340700788
References: #9294

2 years agoFix docs for `case` expression to match new syntax (#9279)
Abdulhaq Emhemmed [Fri, 10 Feb 2023 21:56:30 +0000 (22:56 +0100)] 
Fix docs for `case` expression to match new syntax (#9279)

* Fix docs for `case` expression to match new syntax

Previously (before v1.4), the `whens` arg (when `value` is *not* used) used to be a list of
conditions (a 2 item-tuple of condition + value). From v1.4, these are passed
as positional args and the old syntax is not supported anymore.

* Fix long lines

2 years agoadd requirement, restore test removed in eb0861e8e69f8ce702301c558e552e1aeb2e9eba
Federico Caselli [Fri, 10 Feb 2023 20:06:13 +0000 (21:06 +0100)] 
add requirement, restore test removed in eb0861e8e69f8ce702301c558e552e1aeb2e9eba

Change-Id: I78c12a58eef59ff577a88880a8752151051fd939

2 years agogeneralize adapt_on_names to expect non-named elements
Mike Bayer [Fri, 10 Feb 2023 13:39:21 +0000 (08:39 -0500)] 
generalize adapt_on_names to expect non-named elements

The fix in #9217 opened up adapt_on_names to more kinds of
expressions than it was prepared for; adjust that logic
and also refine in the ORM where we are using it, as we
dont need it (yet) for the DML RETURNING use case.

Fixed regression introduced in version 2.0.2 due to :ticket:`9217` where
using DML RETURNING statements, as well as
:meth:`_sql.Select.from_statement` constructs as was "fixed" in
:ticket:`9217`, in conjunction with ORM mapped classes that used
expressions such as with :func:`_orm.column_property`, would lead to an
internal error within Core where it would attempt to match the expression
by name. The fix repairs the Core issue, and also adjusts the fix in
:ticket:`9217` to not take effect for the DML RETURNING use case, where it
adds unnecessary overhead.

Fixes: #9273
Change-Id: Ie0344efb12ff7df48f21e71e62dc598c76a6a0de

2 years agoVersion 2.0.4 placeholder
Mike Bayer [Fri, 10 Feb 2023 00:15:26 +0000 (19:15 -0500)] 
Version 2.0.4 placeholder

2 years ago- 2.0.3 rel_2_0_3
Mike Bayer [Thu, 9 Feb 2023 23:01:33 +0000 (18:01 -0500)] 
- 2.0.3

2 years agoapply self_group to all elements of multi-expression
Mike Bayer [Thu, 9 Feb 2023 20:36:38 +0000 (15:36 -0500)] 
apply self_group to all elements of multi-expression

Fixed critical regression in SQL expression formulation in the 2.0 series
due to :ticket:`7744` which improved support for SQL expressions that
contained many elements against the same operator repeatedly; parenthesis
grouping would be lost with expression elements beyond the first two
elements.

Fixes: #9271
Change-Id: Ib6ed5b71efe0f6816dab75bda622297fc89e3b49

2 years agopin sphinx-copybutton and change config
Mike Bayer [Thu, 9 Feb 2023 17:05:47 +0000 (12:05 -0500)] 
pin sphinx-copybutton and change config

sphinx-copybutton introduced a new feature
in 0.5.1 which includes a default configuration
that breaks the regexp prompt matching scheme.

set copybutton_exclude to not include ".gp" as that's the class
where we exactly look for the prompts we are matching.
While we're there, use this new feature to exclude our sql
styles, even though this is not strictly necessary in our case.

pin sphinx-copybutton at 0.5.1 to avoid future problems.

Change-Id: I8eaeab13995c032b9ee3afd1f08dae5929009d45
References: https://github.com/executablebooks/sphinx-copybutton/issues/185