]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
5 years agoMerge "Fix query string escaping in engine URLs"
mike bayer [Fri, 22 May 2020 20:17:49 +0000 (20:17 +0000)] 
Merge "Fix query string escaping in engine URLs"

5 years agoMerge "Don't emit pyodbc "no driver" warning for empty URL"
mike bayer [Fri, 22 May 2020 20:12:42 +0000 (20:12 +0000)] 
Merge "Don't emit pyodbc "no driver" warning for empty URL"

5 years agoCross reference do_connect() event w/ creator
Mike Bayer [Fri, 22 May 2020 20:04:17 +0000 (16:04 -0400)] 
Cross reference do_connect() event w/ creator

two questions today involving creator / do_connect,
do_connect is not well known enough, ensure docs are present
and prominent.

Change-Id: I85d518b9fc7b9b069a18010969abefa360134fe9

5 years agoDon't emit pyodbc "no driver" warning for empty URL
Mike Bayer [Fri, 22 May 2020 17:14:58 +0000 (13:14 -0400)] 
Don't emit pyodbc "no driver" warning for empty URL

Fixed an issue in the pyodbc connector such that a warning about pyodbc
"drivername" would be emitted when using a totally empty URL.  Empty URLs
are normal when producing a non-connected dialect object or when using the
"creator" argument to create_engine(). The warning now only emits if the
driver name is missing but other parameters are still present.

Fixes: #5346
Change-Id: I0ee6f5fd5af7faca63bf0d7034410942f40834a8

5 years agoMerge "Structural / performance refinements"
mike bayer [Fri, 22 May 2020 15:45:57 +0000 (15:45 +0000)] 
Merge "Structural / performance refinements"

5 years agoStructural / performance refinements
Mike Bayer [Thu, 21 May 2020 22:18:39 +0000 (18:18 -0400)] 
Structural / performance refinements

* state connection schema_translate_map entirely in terms of
  execution options, support for per-execution options as well

* use slots for role impls, remove superclass of the roles
  themselves as this is not needed

* tighten loop in resolve, might become a C function

Change-Id: Ib98ac9b65022fbf976e49c6060e4c37573528c5f

5 years agoDon't incref on new reference key_style
Mike Bayer [Fri, 22 May 2020 14:13:02 +0000 (10:13 -0400)] 
Don't incref on new reference key_style

in 4550983e0ce2f35b3585e53894c941c23693e71d we
added a new attribute key_style.  remove an erroneous
Py_INCREF when we acquire it from PyLong_FromLong
as we already own the reference.    since this
is a new reference we actualy need to Py_DECREF
it because we aren't returning it.

Change-Id: I61470513a173c76863ec6f7f5ff9b2ec13582f08

5 years agoMerge "Performance fixes for new result set"
mike bayer [Thu, 21 May 2020 19:03:32 +0000 (19:03 +0000)] 
Merge "Performance fixes for new result set"

5 years agoFix query string escaping in engine URLs
Miguel Grinberg [Thu, 21 May 2020 09:54:47 +0000 (05:54 -0400)] 
Fix query string escaping in engine URLs

Fixed issue in :class:`.URL` object where stringifying the object
would not URL encode special characters, preventing the URL from being
re-consumable as a real URL.  Pull request courtesy Miguel Grinberg.

Fixes: #5341
Closes: #5342
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5342
Pull-request-sha: 362ca3398336a3a892e8020530f0c68d4f2d1d01

Change-Id: Ief6218122d1ec0c70479eb1a90e1c16433801924

5 years agoPerformance fixes for new result set
Mike Bayer [Wed, 20 May 2020 17:41:44 +0000 (13:41 -0400)] 
Performance fixes for new result set

A few small mistakes led to huge callcounts.   Additionally,
the warn-on-get behavior which is attempting to warn for
deprecated access in SQLAlchemy 2.0 is very expensive; it's not clear
if its feasible to have this warning or to somehow alter how it
works.

Fixes: #5340
Change-Id: I73bdd2d7b6f1b25cc0222accabd585cf761a5af4

5 years agoTarget real pypi in the create wheel workflow
Federico Caselli [Wed, 20 May 2020 19:31:16 +0000 (21:31 +0200)] 
Target real pypi in the create wheel workflow

Change-Id: Ic764aae08b9d45011048f21c8ee992222c078bd2

5 years agofix table.schema version to 1.3.18
Mike Bayer [Tue, 19 May 2020 22:55:16 +0000 (18:55 -0400)] 
fix table.schema version to 1.3.18

Fixes: #5338
Change-Id: I12ce8021f5627c306c768b74da991ef4af0a5b55

5 years agoMerge "SQLite 3.31 added support for computed column."
mike bayer [Tue, 19 May 2020 20:18:40 +0000 (20:18 +0000)] 
Merge "SQLite 3.31 added support for computed column."

5 years agoMerge "Introduce :class:`.IdentityOptions` to store common parameters for sequences...
mike bayer [Tue, 19 May 2020 19:47:16 +0000 (19:47 +0000)] 
Merge "Introduce :class:`.IdentityOptions` to store common parameters for sequences and identity columns."

5 years agoDisable "check unicode returns" under Python 3
Mike Bayer [Thu, 7 May 2020 14:53:15 +0000 (10:53 -0400)] 
Disable "check unicode returns" under Python 3

Disabled the "unicode returns" check that runs on dialect startup when
running under Python 3, which for many years has occurred in order to test
the current DBAPI's behavior for whether or not it returns Python Unicode
or Py2K strings for the VARCHAR and NVARCHAR datatypes.  The check still
occurs by default under Python 2, however the mechanism to test the
behavior will be removed in SQLAlchemy 2.0 when Python 2 support is also
removed.

This logic was very effective when it was needed, however now that Python 3
is standard, all DBAPIs are expected to return Python 3 strings for
character datatypes.  In the unlikely case that a third party DBAPI does
not support this, the conversion logic within :class:`.String` is still
available and the third party dialect may specify this in its upfront
dialect flags by setting the dialect level flag ``returns_unicode_strings``
to one of :attr:`.String.RETURNS_CONDITIONAL` or
:attr:`.String.RETURNS_BYTES`, both of which will enable Unicode conversion
even under Python 3.

As part of this change, disabling testing of the doctest tutorials under
Python 2.

Fixes: #5315
Change-Id: I1260e894611409d3b7fe1a92bd90c52043bbcf19

5 years agoSQLite 3.31 added support for computed column.
Federico Caselli [Fri, 1 May 2020 20:22:51 +0000 (22:22 +0200)] 
SQLite 3.31 added support for computed column.

This change enables their support in SQLAlchemy when targeting SQLite.

Fixes: #5297
Change-Id: Ia9f21a49e58fc977e3c669b8176036c95d93b9c8

5 years agoStreamline visitors.iterate
Mike Bayer [Mon, 18 May 2020 20:08:33 +0000 (16:08 -0400)] 
Streamline visitors.iterate

This method might be used more significantly in the
ORM refactor, so further refine it.

* all get_children() methods now work entirely based on iterators.
  Basically only select() was sensitive to this anymore and it now
  chains the iterators together

* remove all kinds of flags like column_collections, schema_visitor
  that apparently aren't used anymore.

* remove the "depthfirst" visitors as these don't seem to be
  used either.

* make sure select() yields its columns first as these will be used
  to determine the current mapper.

Change-Id: I05273a2d5306a57c2d1b0979050748cf3ac964bf

5 years agoMerge "Update transaction / connection handling"
mike bayer [Sun, 17 May 2020 22:00:16 +0000 (22:00 +0000)] 
Merge "Update transaction / connection handling"

5 years agoUpdate transaction / connection handling
Mike Bayer [Thu, 14 May 2020 16:50:11 +0000 (12:50 -0400)] 
Update transaction / connection handling

step one, do away with __connection attribute and using
awkward AttributeError logic

step two, move all management of "connection._transaction"
into the transaction objects themselves where it's easier
to follow.

build MarkerTransaction that takes the role of
"do-nothing block"

new connection datamodel is: connection._transaction, always
a root, connection._nested_transaction, always a nested.

nested transactions still chain to each other as this
is still sort of necessary but they consider the root
transaction separately, and the marker transactions
not at all.

introduce new InvalidRequestError subclass
PendingRollbackError.  Apply to connection and session
for all cases where a transaction needs to be rolled
back before continuing.   Within Connection,
both PendingRollbackError as well as ResourceClosedError
are now raised directly without being handled by
handle_dbapi_error();  this removes these two exception
cases from the handle_error event handler as well as
from StatementError wrapping, as these two exceptions are
not statement oriented and are instead programmatic
issues, that the application is failing to handle database
errors properly.

Revise savepoints so that when a release fails, they set
themselves as inactive so that their rollback() method
does not throw another exception.

Give savepoints another go on MySQL, can't get release working
however get support for basic round trip going

Fixes: #5327
Change-Id: Ia3cbbf56d4882fcc7980f90519412f1711fae74d

5 years agoReword delete-orphan on many error message and document
Mike Bayer [Sat, 16 May 2020 17:05:00 +0000 (13:05 -0400)] 
Reword delete-orphan on many error message and document

For many years we have encountered users making use of the
"single_parent" flag in response to the error message for
"delete-orphan" expressing this as a means to cancel the current
error.   However, the actual issue here is usually a misuse
of the delete-orphan cascade setting.  Reword the error message to
be much more descriptive about what this means and add new
error link sections describing the situation in as much detail
as possible.

Fixes: #5329
Change-Id: I7ba710378b2935479ab22ff9a0a79c692dbf69a6

5 years agoIntroduce :class:`.IdentityOptions` to store common parameters for
Federico Caselli [Thu, 14 May 2020 20:57:56 +0000 (22:57 +0200)] 
Introduce :class:`.IdentityOptions` to store common parameters for
sequences and identity columns.

References: #5324
Change-Id: I72f7fc1a003456206b004d3d26306940f9c36414

5 years agoMerge "Add 'schema' parameter to table"
mike bayer [Fri, 15 May 2020 17:11:20 +0000 (17:11 +0000)] 
Merge "Add 'schema' parameter to table"

5 years agoMerge "Adjust documentation wording for firebird and sybase"
mike bayer [Fri, 15 May 2020 15:15:45 +0000 (15:15 +0000)] 
Merge "Adjust documentation wording for firebird and sybase"

5 years agoMerge "Move supports_sane_rowcount_returning = False to dialect level"
mike bayer [Fri, 15 May 2020 15:14:55 +0000 (15:14 +0000)] 
Merge "Move supports_sane_rowcount_returning = False to dialect level"

5 years agoAdjust documentation wording for firebird and sybase
Gord Thompson [Fri, 15 May 2020 12:07:57 +0000 (06:07 -0600)] 
Adjust documentation wording for firebird and sybase

Change-Id: Ied2cdab1c2dbdee681a5500285a5bcdd4d589afa

5 years agoActively unset reset agent in discard transaction
Mike Bayer [Thu, 14 May 2020 14:51:29 +0000 (10:51 -0400)] 
Actively unset reset agent in discard transaction

The assumptions in _discard_transaction from
916e1fea25afcd07fa1d1d2f72043b372cd02223 were too narrow,
assuming that if the given transaction were not our
"current" one, that this would not be the reset agent.  however
as the legacy behvaior is that even a "nested" transaction gets
set as "self._transaction", this did not accommodate for the nested
transaction being thrown away.   We will attempt to refine all of this
logic in #5327 for 1.4 /master assuming this is feasible for the
full suite of current use cases.

Fixes: #5326
Change-Id: I6787e82c9e50c23317f87d0d094122c6a6f066da

5 years agoRestore unreleased_XY directories
Mike Bayer [Thu, 14 May 2020 14:40:07 +0000 (10:40 -0400)] 
Restore unreleased_XY directories

these directories were removed in 4e5b7e6e62461d2685c1586dbb4cb1db88ff4ab0
which breaks the documentation builds.

Change-Id: I17aa66bf95c69a075a68e78245fad3bef85dc29e

5 years agocherry-pick changelog update for 1.3.18
Mike Bayer [Wed, 13 May 2020 21:40:41 +0000 (17:40 -0400)] 
cherry-pick changelog update for 1.3.18

5 years agocherry-pick changelog from 1.3.17
Mike Bayer [Wed, 13 May 2020 21:40:40 +0000 (17:40 -0400)] 
cherry-pick changelog from 1.3.17

5 years agoMerge "Assert reset agent always set correctly and is active"
mike bayer [Wed, 13 May 2020 21:34:14 +0000 (21:34 +0000)] 
Merge "Assert reset agent always set correctly and is active"

5 years agoAssert reset agent always set correctly and is active
Mike Bayer [Wed, 13 May 2020 16:42:08 +0000 (12:42 -0400)] 
Assert reset agent always set correctly and is active

Fixed fairly critical issue where the DBAPI connection could be returned to
the connection pool while still in an un-rolled-back state. The reset agent
responsible for rolling back the connection could be corrupted in the case
that the transaction was "closed" without being rolled back or committed,
which can occur in some scenarios when using ORM sessions and emitting
.close() in a certain pattern involving savepoints.   The fix ensures that
the reset agent is always active.

note that the reset agent will go away in 2.0 and the only real
purpose of it is for logging of ROLLBACK.   Apparently with the
SQLite singleton engine in the test suite, there are some strucutral
mismatches in the test fixtures where the reset agent is getting
set differently than the transaction likely due to the same connection
being shared in multiple context, though it's unclear.

Fixes: #5326
Change-Id: If056870ea70a2d9a1749768988d5e023f3061b31

5 years agoMerge "Load external firebird or sybase dialect if available"
mike bayer [Wed, 13 May 2020 17:15:59 +0000 (17:15 +0000)] 
Merge "Load external firebird or sybase dialect if available"

5 years agoMerge "Fix typo in changelog of 5237"
mike bayer [Tue, 12 May 2020 22:31:49 +0000 (22:31 +0000)] 
Merge "Fix typo in changelog of 5237"

5 years agoFix typo in changelog of 5237
Federico Caselli [Tue, 12 May 2020 19:37:50 +0000 (21:37 +0200)] 
Fix typo in changelog of 5237

Change-Id: I9e526b133c130c1656fd09e5fecdc3a84c425d46

5 years agoMove supports_sane_rowcount_returning = False to dialect level
Gord Thompson [Mon, 11 May 2020 20:44:37 +0000 (14:44 -0600)] 
Move supports_sane_rowcount_returning = False to dialect level

Fixes: #5321
Change-Id: Id83e98e9013818424c133297a850746302633158

5 years agoEnsure order in doctest of core/tutorial.rst
Federico Caselli [Sun, 10 May 2020 12:37:21 +0000 (14:37 +0200)] 
Ensure order in doctest of core/tutorial.rst

Fix doctest error caused by the missing order by clause in the
tests introduced in Ia1bbe3248b4f7c74fbee06fedf76a6ce94cd28a6

Change-Id: I55b45690879ebbaa57bc62765fcdab06f5e9c6f3

5 years agoLoad external firebird or sybase dialect if available
Gord Thompson [Fri, 8 May 2020 11:52:02 +0000 (05:52 -0600)] 
Load external firebird or sybase dialect if available

Fixes: #5318
Extension of I1660abb11c02656fbf388f2f9c4257075111be58

Change-Id: I32b678430497327f9b08f821bd345a2557e34b1f

5 years agoAdd 'schema' parameter to table
Dylan Modesitt [Wed, 6 May 2020 18:17:23 +0000 (14:17 -0400)] 
Add 'schema' parameter to table

Added a "schema" parameter to the :func:`_expression.table` construct,
allowing ad-hoc table expressions to also include a schema name.
Pull request courtesy Dylan Modesitt.

Fixes: #5309
Closes: #5310
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5310
Pull-request-sha: ce85681050500186678131f948b6ea277a65dc17
Change-Id: I32015d593e1ee1121c7426fbffdcc565d025fad1

5 years agoMerge "Use cx_oracle.LONG_STRING /LONG_BINARY for CLOB/BLOB"
mike bayer [Sat, 9 May 2020 20:19:34 +0000 (20:19 +0000)] 
Merge "Use cx_oracle.LONG_STRING /LONG_BINARY for CLOB/BLOB"

5 years agoMerge "Warn when sorted_tables is not actually sorting"
mike bayer [Sat, 9 May 2020 13:57:21 +0000 (13:57 +0000)] 
Merge "Warn when sorted_tables is not actually sorting"

5 years agoMerge "Expand CTE testing and begin to make this more prominent."
mike bayer [Sat, 9 May 2020 13:54:53 +0000 (13:54 +0000)] 
Merge "Expand CTE testing and begin to make this more prominent."

5 years agoUse cx_oracle.LONG_STRING /LONG_BINARY for CLOB/BLOB
Mike Bayer [Thu, 7 May 2020 17:56:38 +0000 (13:56 -0400)] 
Use cx_oracle.LONG_STRING /LONG_BINARY for CLOB/BLOB

Changed the implementation of fetching CLOB and BLOB objects to use
cx_Oracle's native implementation which fetches CLOB/BLOB objects inline
with other result columns, rather than performing a separate fetch. As
always, this can be disabled by setting auto_convert_lobs to False.

As part of this change, the behavior of a CLOB that was given a blank
string on INSERT now returns None on SELECT, which is now consistent with
that of VARCHAR on Oracle.

Fixes: #5314
Change-Id: I7b46c91704b6f5d6c157e083505dac6e0cb3ef6e

5 years agoExpand CTE testing and begin to make this more prominent.
Mike Bayer [Fri, 8 May 2020 15:25:14 +0000 (11:25 -0400)] 
Expand CTE testing and begin to make this more prominent.

SQLite supports CTEs as do both the MariaDB and MySQL
databases now.  Expand test support and begin adding
new tutorial sections to make this concept more prominent.

Also fix some formatting issues in the tutorial, and start
moving more towards {opensql} - the "SQL" button thing
is cool but the tutorials mainly need to illustrate how
the SQL looks for things.  Screens are bigger now and
we likely should move away from the SQL button almost
entirely.

CTE for the tutorial needed zzzeeksphinx fix to recognize
"WITH" so bumping that to latest release number in git.

Change-Id: Ia1bbe3248b4f7c74fbee06fedf76a6ce94cd28a6
References: #5269

5 years agoMerge "Add sync_backref flag in a relationship"
mike bayer [Fri, 8 May 2020 15:41:46 +0000 (15:41 +0000)] 
Merge "Add sync_backref flag in a relationship"

5 years agoWarn when sorted_tables is not actually sorting
Mike Bayer [Thu, 7 May 2020 21:13:35 +0000 (17:13 -0400)] 
Warn when sorted_tables is not actually sorting

A warning is emitted when making use of the :attr:`.MetaData.sorted_tables`
attribute as well as the :func:`_schema.sort_tables` function, and the
given tables cannot be correctly sorted due to a cyclic dependency between
foreign key constraints. In this case, the functions will no longer sort
the involved tables by foreign key, and a warning will be emitted. Other
tables that are not part of the cycle will still be returned in dependency
order. Previously, the sorted_table routines would return a collection that
would unconditionally omit all foreign keys when a cycle was detected, and
no warning was emitted.

Fixes: #5316
Change-Id: I14f72ccf39cb568bc77e8da16d0685718b2b9960

5 years agoMerge "Add warn_deprecated_limited feature"
mike bayer [Wed, 6 May 2020 14:25:22 +0000 (14:25 +0000)] 
Merge "Add warn_deprecated_limited feature"

5 years agoMerge "fixes #4212 raise an error if selectable and flat/aliased are sent to with_pol...
mike bayer [Wed, 6 May 2020 14:21:53 +0000 (14:21 +0000)] 
Merge "fixes #4212 raise an error if selectable and flat/aliased are sent to with_polymorphic simultaenously"

5 years agoClarify create_engine encoding; update cx_Oracle
Mike Bayer [Wed, 6 May 2020 13:47:26 +0000 (09:47 -0400)] 
Clarify create_engine encoding; update cx_Oracle

The create_engine()->encoding parameter is mostly irrelevant
under Python 3.  make it clear this parameter is not generally
useful anymore and refer readers to the dialect documenation.

Update cx_Oracle documentation to feature many examples of
the encoding / nencoding parameters, remove extra detail that
is not generally useful and reorganize information into
more specific sections, de-emphasizing legacy / Python 2
specific sections.

Change-Id: I42dafb85de0a585c9e05e1e3d787d8d6bfa632c0

5 years agoAdd sync_backref flag in a relationship
Federico Caselli [Wed, 22 Apr 2020 21:25:57 +0000 (23:25 +0200)] 
Add sync_backref flag in a relationship

Introduce :paramref:`_orm.relationship.sync_backref` flag in a relationship
to control if the synchronization events that mutate the in-Python
attributes are added.
This flag is implied in a ``viewonly=True`` relationship.
This supersedes the previous change #5149, that warned that ``viewonly=True``
relationship target of a back_populates or backref configuration would be
disallowed.

Fixes: #5237
Change-Id: I22c5ba28dcea22fc78a83e68e667140edffc515c

5 years agoConsider aliased=True, from_joinpoint as legacy
Mike Bayer [Mon, 4 May 2020 19:48:48 +0000 (15:48 -0400)] 
Consider aliased=True, from_joinpoint as legacy

For a 1.4 / 1.3 merge, rewrite the documentation for
Query.join() to indicate calling forms that are now considered
legacy, including the use of strings in join(), sending a
series of join paths in one call, and using the aliased=True
flag.   update the elementtree examples as well to use aliased()
(they are much simpler to understand this way too) and update
other links.

Also improve docs for aliased() and some other ORM targets
such as PropComparator.

Change-Id: I636e3a9130dc5509e51c2cf60a52f38fcadffbc6
References: #4705

5 years agoMerge "Don't apply sets or similar to objects in IdentitySet"
mike bayer [Mon, 4 May 2020 17:09:57 +0000 (17:09 +0000)] 
Merge "Don't apply sets or similar to objects in IdentitySet"

5 years agoBaked query needs to spoil fully on uncachable option
Mike Bayer [Sun, 3 May 2020 23:35:54 +0000 (19:35 -0400)] 
Baked query needs to spoil fully on uncachable option

Fixed issue in the area of where loader options such as selectinload()
interact with the baked query system, such that the caching of a query is
not supposed to occur if the loader options themselves have elements such
as with_polymorphic() objects in them that currently are not
cache-compatible.  The baked loader could sometimes not fully invalidate
itself in these some of these scenarios leading to missed eager loads.

Fixes: #5303
Change-Id: Iecf847204a619694d89297f83b63b613ef9767de

5 years agoDon't apply sets or similar to objects in IdentitySet
Mike Bayer [Mon, 4 May 2020 00:27:24 +0000 (20:27 -0400)] 
Don't apply sets or similar to objects in IdentitySet

Modified the internal "identity set" implementation, which is a set that
hashes objects on their id() rather than their hash values, to not actually
call the ``__hash__()`` method of the objects, which are typically
user-mapped objects.  Some methods were calling this method as a side
effect of the implementation.

Fixes: #5304
Change-Id: I0ed8762f47622215a54dcad9f210377b1becf8e8

5 years agoFix links in future engine to refer to engine.Result
Mike Bayer [Sat, 2 May 2020 18:59:15 +0000 (14:59 -0400)] 
Fix links in future engine to refer to engine.Result

Change-Id: I1d24db707de15fbdc05e80e0705590eb93d055d0

5 years agoIntegrate new Result into ORM query
Mike Bayer [Fri, 24 Apr 2020 19:34:19 +0000 (15:34 -0400)] 
Integrate new Result into ORM query

The next step in the 2.0 ORM changes is to have the
ORM integrate with the new Result object fully.

this patch uses Result to represent ORM objects rather
than lists.  public API to get at this Result is not
added yet.   dogpile.cache and horizontal sharding
recipe/extensions have small adjustments to accommodate
this change.

Callcounts have fluctuated, some slightly better and
some slightly worse.  A few have gone up by a bit,
however as the codebase is still in flux it is anticipated
there will be some performance gains later on as
ORM fetching is refined to no longer need to accommodate
for extensive aliasing.   The addition of caching
will then change the entire story.

References: #5087
References: #4395

Change-Id: If1a23824ffb77d8d58cf2338cf35dd6b5963b17f

5 years agoMerge "Capitalize documentation for relationship params"
mike bayer [Sat, 2 May 2020 03:34:07 +0000 (03:34 +0000)] 
Merge "Capitalize documentation for relationship params"

5 years agoMerge "Handle non-string, non column expression in index for deferred attach"
mike bayer [Sat, 2 May 2020 03:33:18 +0000 (03:33 +0000)] 
Merge "Handle non-string, non column expression in index for deferred attach"

5 years agoDocumentation updates for ResultProxy -> Result
Mike Bayer [Sun, 26 Apr 2020 14:59:34 +0000 (10:59 -0400)] 
Documentation updates for ResultProxy -> Result

This is based off of
I8091919d45421e3f53029b8660427f844fee0228 and includes
all documentation-only changes as a separate merge,
once the parent is merged.

Change-Id: I711adea23df0f9f0b1fe7c76210bd2de6d31842d

5 years agoHandle non-string, non column expression in index for deferred attach
Mike Bayer [Sat, 2 May 2020 00:30:18 +0000 (20:30 -0400)] 
Handle non-string, non column expression in index for deferred attach

Fixed issue where an :class:`.Index` that is deferred in being associated
with a table, such as as when it contains a :class:`.Column` that is not
associated with any :class:`.Table` yet,  would fail to attach correctly if
it also contained a non table-oriented expession.

Fixes: #5298
Change-Id: I0111c400f6bd4a9f31bf00a9957816c7a3fac783

5 years agoMerge "Propose Result as immediate replacement for ResultProxy"
mike bayer [Fri, 1 May 2020 23:19:32 +0000 (23:19 +0000)] 
Merge "Propose Result as immediate replacement for ResultProxy"

5 years agoPropose Result as immediate replacement for ResultProxy
Mike Bayer [Tue, 21 Apr 2020 16:51:13 +0000 (12:51 -0400)] 
Propose Result as immediate replacement for ResultProxy

As progress is made on the _future.Result, including breaking
it out such that DBAPI behaviors are local to specific
implementations, it becomes apparent that the Result object
is a functional superset of ResultProxy and that basic
operations like fetchone(), fetchall(), and fetchmany()
behave pretty much exactly the same way on the new object.
Reorganize things so that ResultProxy is now referred to
as LegacyCursorResult, which subclasses CursorResult
that represents the DBAPI-cursor version of Result,
making use of a multiple inheritance pattern so that
the functionality of Result is also available in non-DBAPI
contexts, as will be necessary for some ORM
patterns.

Additionally propose the composition system for Result
that will form the basis for ORM-alternative result
systems such as horizontal sharding and dogpile cache.
As ORM results will soon be coming directly from
instances of Result, these extensions will instead
build their own ResultFetchStrategies that perform
the special steps to create composed or cached
result sets.

Also considering at the moment not emitting deprecation
warnings for fetchXYZ() methods; the immediate issue
is Keystone tests are calling upon it, but as the
implementations here are proving to be not in any
kind of conflict with how Result works, there's
not too much issue leaving them around and deprecating
at some later point.

References: #5087
References: #4395
Fixes: #4959
Change-Id: I8091919d45421e3f53029b8660427f844fee0228

5 years agoAdd warn_deprecated_limited feature
Gord Thompson [Fri, 24 Apr 2020 12:23:19 +0000 (06:23 -0600)] 
Add warn_deprecated_limited feature

Fixes: #5268
Change-Id: I2f976048af4f8d6dd03a14efa31d179bd7324ba6

5 years agoMerge "Enable loading of external Firebird dialect, if available"
Gord Thompson [Fri, 1 May 2020 16:27:07 +0000 (16:27 +0000)] 
Merge "Enable loading of external Firebird dialect, if available"

5 years agorepair test_fetch_results
Mike Bayer [Thu, 30 Apr 2020 19:06:03 +0000 (15:06 -0400)] 
repair test_fetch_results

this profiling test was not actually loading the related
objects.

Change-Id: I9d18a44f50f72f6653f736708829365eb561160e

5 years agoEnable loading of external Firebird dialect, if available
Gord Thompson [Fri, 24 Apr 2020 15:05:47 +0000 (09:05 -0600)] 
Enable loading of external Firebird dialect, if available

Fixes: #5278
Change-Id: I1660abb11c02656fbf388f2f9c4257075111be58

5 years agoDeprecate unsupported dialects and dbapi
Federico Caselli [Sat, 18 Apr 2020 18:58:41 +0000 (20:58 +0200)] 
Deprecate unsupported dialects and dbapi

- Deprecate dialects firebird and sybase.

- Deprecate DBAPI

  - mxODBC for mssql

  - oursql for mysql

  - pygresql and py-postgresql for postgresql

- Removed adodbapi DBAPI for mssql

Fixes: #5189
Change-Id: Id9025f4f4de7e97d65aacd0eb4b0c21beb9a67b5

5 years agoRestore a line break that is needed for a clean merge
Mike Bayer [Wed, 29 Apr 2020 14:44:48 +0000 (10:44 -0400)] 
Restore a line break that is needed for a clean merge

Change-Id: Ib433920080ba159a1478c48d2f837bc71bf5bbbc

5 years agoCapitalize documentation for relationship params
Federico Caselli [Tue, 28 Apr 2020 20:28:33 +0000 (22:28 +0200)] 
Capitalize documentation for relationship params

Change-Id: Iec1f0afcc57177a7463d8238f1c5d6bb8b86bbb3

5 years agoMerge "Alias the onclause if ORM join is to same polymorphic selectable"
mike bayer [Tue, 28 Apr 2020 18:37:43 +0000 (18:37 +0000)] 
Merge "Alias the onclause if ORM join is to same polymorphic selectable"

5 years agofixes #4212 raise an error if selectable and flat/aliased are sent to with_polymorphi...
RamonWill [Tue, 28 Apr 2020 18:19:06 +0000 (14:19 -0400)] 
fixes #4212 raise an error if selectable and flat/aliased are sent to with_polymorphic simultaenously

<!-- Provide a general summary of your proposed changes in the Title field above -->
Hi,
This is a proposed fix for Issue #4212

When the selectable argument is passed to with_polymorphic it is already aliased. Therefore an argument error should be raised if flat is also True. I have added an if statement to the with_polymorphic function, that raises an Argument Error if selectable is none/False AND if flat=True. I have also included a test.

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [X ] A short code fix
- please include the issue number, and create an issue if none exists, which
  must include a complete example of the issue.  one line code fixes without an
  issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.   one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
  include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.

Kind Regards,

Ramon

Closes: #5232
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5232
Pull-request-sha: eae20cdadac82ca1e0352000fe0211e20b590e8b

Change-Id: I49c3022296608ede43de7f508fa993fa97dda81a

5 years agoother minor cleanups 5287/head
Federico Caselli [Tue, 28 Apr 2020 17:11:30 +0000 (19:11 +0200)] 
other minor cleanups

Change-Id: Ie7b8cec01ce36f2619b3e3bcb3152747be673ca3

5 years agoAlias the onclause if ORM join is to same polymorphic selectable
Mike Bayer [Mon, 27 Apr 2020 20:51:43 +0000 (16:51 -0400)] 
Alias the onclause if ORM join is to same polymorphic selectable

Fixed bug where using :func:`.with_polymorphic` as the target of a join via
:meth:`.RelationshipComparator.of_type` on a mapper that already has a
subquery-based with_polymorphic setting that's equivalent to the one
requested would not correctly alias the ON clause in the join.

Fixes: #5288
Change-Id: I0212a990ee67a344c87fe21833bf47fdb72ca0cc

5 years agofix typo SQLAchemy -> SQLAlchemy
Federico Caselli [Mon, 27 Apr 2020 19:10:32 +0000 (21:10 +0200)] 
fix typo SQLAchemy -> SQLAlchemy

Change-Id: If03ccc2c2bec1c48eb6ed26091e1588b3b46e781

5 years agoUpdate automatic label 5279/head
Federico Caselli [Fri, 24 Apr 2020 16:42:46 +0000 (18:42 +0200)] 
Update automatic label

Change-Id: I5a1496a3bd55eb8f9863b9b8cb84f1784c26dbf0

5 years agoImprove bug report
Federico Caselli [Thu, 23 Apr 2020 19:11:17 +0000 (21:11 +0200)] 
Improve bug report

5 years agoUpdate issue templates
Federico Caselli [Thu, 23 Apr 2020 18:58:30 +0000 (20:58 +0200)] 
Update issue templates

5 years agoAdd code of conduct and contributing
Federico Caselli [Thu, 23 Apr 2020 18:51:28 +0000 (20:51 +0200)] 
Add code of conduct and contributing

Change-Id: I9793920a9f082ee85be0f4c94f2ce208cf2c6be9

5 years agoMerge "Fix regression when reflecting tables in MSSQL"
mike bayer [Wed, 22 Apr 2020 21:23:15 +0000 (21:23 +0000)] 
Merge "Fix regression when reflecting tables in MSSQL"

5 years agoFix regression when reflecting tables in MSSQL
Federico Caselli [Thu, 16 Apr 2020 21:01:03 +0000 (23:01 +0200)] 
Fix regression when reflecting tables in MSSQL

Fix a regression introduced by the reflection of computed column in
MSSQL when using SQL server versions before 2012, which does not support
the ``concat`` function and when using the legacy TDS version 4.2.
The dialect will try to detect the protocol version of first connect
and run in compatibility mode if it cannot detect it.

Fixes: #5255
Fixes: #5271
Change-Id: I7b33f7889ac0784cd8ae5385cbd50bc8c862398a

5 years agoMerge "Add ColumnProperty.Comparator.expressions"
mike bayer [Tue, 21 Apr 2020 16:11:37 +0000 (16:11 +0000)] 
Merge "Add ColumnProperty.Comparator.expressions"

5 years agoAdd ColumnProperty.Comparator.expressions
Mike Bayer [Mon, 20 Apr 2020 16:24:40 +0000 (12:24 -0400)] 
Add ColumnProperty.Comparator.expressions

Added an accessor :attr:`.ColumnProperty.Comparator.expressions` which
provides access to the group of columns mapped under a multi-column
:class:`.ColumnProperty` attribute.

Fixes: #5262
Change-Id: I44cf53ff0e6cf76a0c90eee4638ca96da3df8088

5 years agoFix typo in pymssql documentation; minor clarification
Gord Thompson [Mon, 20 Apr 2020 19:16:20 +0000 (13:16 -0600)] 
Fix typo in pymssql documentation; minor clarification

Change-Id: I4aaf0627d2f1ccae82c2eb41db9ec219d73ce4ea

5 years agoMerge "Deprecate ``DISTINCT ON`` when not targeting PostgreSQL"
mike bayer [Mon, 20 Apr 2020 17:15:54 +0000 (17:15 +0000)] 
Merge "Deprecate ``DISTINCT ON`` when not targeting PostgreSQL"

5 years agoMerge "Support `ARRAY` of `Enum`, `JSON` or `JSONB`"
mike bayer [Mon, 20 Apr 2020 17:12:22 +0000 (17:12 +0000)] 
Merge "Support `ARRAY` of `Enum`, `JSON` or `JSONB`"

5 years agoSupport `ARRAY` of `Enum`, `JSON` or `JSONB`
Federico Caselli [Sun, 19 Apr 2020 18:09:39 +0000 (20:09 +0200)] 
Support `ARRAY` of `Enum`, `JSON` or `JSONB`

Added support for columns or type :class:`.ARRAY` of :class:`.Enum`,
:class:`.JSON` or :class:`_postgresql.JSONB` in PostgreSQL.
Previously a workaround was required in these use cases.
Raise an explicit :class:`.exc.CompileError` when adding a table with a
column of type :class:`.ARRAY` of :class:`.Enum` configured with
:paramref:`.Enum.native_enum` set to ``False`` when
:paramref:`.Enum.create_constraint` is not set to ``False``

Fixes: #5265
Fixes: #5266
Change-Id: I83a2d20a599232b7066d0839f3e55ff8b78cd8fc

5 years agoMerge "Raise informative error when non-object m2o comparison used"
mike bayer [Mon, 20 Apr 2020 15:31:05 +0000 (15:31 +0000)] 
Merge "Raise informative error when non-object m2o comparison used"

5 years agoDeprecate ``DISTINCT ON`` when not targeting PostgreSQL
Federico Caselli [Thu, 16 Apr 2020 21:16:32 +0000 (23:16 +0200)] 
Deprecate ``DISTINCT ON`` when not targeting PostgreSQL

Deprecate usage of ``DISTINCT ON`` in dialect other than PostgreSQL.
Previously this was silently ignored.
Deprecate old usage of string distinct in MySQL dialect

Fixes: #4002
Change-Id: I38fc64aef75e77748083c11d388ec831f161c9c9

5 years agoClean up .execute in test/sql/test_functions.py
Gord Thompson [Tue, 14 Apr 2020 13:15:07 +0000 (07:15 -0600)] 
Clean up .execute in test/sql/test_functions.py

Change-Id: I2bc7a50893f90c6ea7e119a8558731ee32965871

5 years agoMerge remote-tracking branch 'origin/pr/5247'
Mike Bayer [Mon, 20 Apr 2020 13:43:27 +0000 (09:43 -0400)] 
Merge remote-tracking branch 'origin/pr/5247'

Change-Id: I781c1083c373a417cbf33946daae556249fcd487

5 years agoMerge "Update pymssql information for mssql dialect"
mike bayer [Mon, 20 Apr 2020 13:12:51 +0000 (13:12 +0000)] 
Merge "Update pymssql information for mssql dialect"

5 years agoUpdate pymssql information for mssql dialect
Gord Thompson [Sat, 18 Apr 2020 23:04:03 +0000 (17:04 -0600)] 
Update pymssql information for mssql dialect

Change-Id: I94cf63299a094b53e7078b282311f7d0faa256a6

5 years agoMerge "Rename py.test to pytest"
mike bayer [Mon, 20 Apr 2020 13:04:32 +0000 (13:04 +0000)] 
Merge "Rename py.test to pytest"

5 years agoRaise informative error when non-object m2o comparison used
Mike Bayer [Sun, 19 Apr 2020 20:52:54 +0000 (16:52 -0400)] 
Raise informative error when non-object m2o comparison used

An informative error message is raised when an ORM many-to-one comparison
is attempted against an object that is not an actual mapped instance.
Comparisons such as those to scalar subqueries aren't supported;
generalized comparison with subqueries is better achieved using
:meth:`~.RelationshipProperty.Comparator.has`.

Fixes: #5269
Change-Id: I2e23178eb59728c39241a46bfa7411239a87492e

5 years agoAdd @requirements.schemas to test_create_table_schema
Gord Thompson [Sat, 18 Apr 2020 14:41:04 +0000 (08:41 -0600)] 
Add @requirements.schemas to test_create_table_schema

Prevent test_create_table_schema from failing for databases that do not support schemas.

Change-Id: I0f5f129c313ee6023be2e6d84610355afc48c05c

5 years agoRename py.test to pytest
Gord Thompson [Thu, 16 Apr 2020 22:06:36 +0000 (16:06 -0600)] 
Rename py.test to pytest

Change-Id: I431e1ef41e26d490343204a75a5c097768749768

5 years agoCreate initial 2.0 engine implementation
Mike Bayer [Tue, 7 Apr 2020 18:15:43 +0000 (14:15 -0400)] 
Create initial 2.0 engine implementation

Implemented the SQLAlchemy 2 :func:`.future.create_engine` function which
is used for forwards compatibility with SQLAlchemy 2.   This engine
features always-transactional behavior with autobegin.

Allow execution options per statement execution.  This includes
that the before_execute() and after_execute() events now accept
an additional dictionary with these options, empty if not
passed; a legacy event decorator is added for backwards compatibility
which now also emits a deprecation warning.

Add some basic tests for execution, transactions, and
the new result object.   Build out on a new testing fixture
that swaps in the future engine completely to start with.

Change-Id: I70e7338bb3f0ce22d2f702537d94bb249bd9fb0a
Fixes: #4644
5 years agoMerge "Pass connection to TablesTest.insert_data()"
mike bayer [Wed, 15 Apr 2020 18:31:30 +0000 (18:31 +0000)] 
Merge "Pass connection to TablesTest.insert_data()"

5 years agoPass connection to TablesTest.insert_data()
Mike Bayer [Tue, 14 Apr 2020 19:30:28 +0000 (15:30 -0400)] 
Pass connection to TablesTest.insert_data()

towards the goal of reducing verbosity and repetition
in test fixtures as well as that we are moving to
connection only for execution, move the insert_data()
classmethod to accept a connection and adjust all
fixtures to use it.

Change-Id: I3bf534acca0d5f4cda1d4da8ae91f1155b829b09

5 years agoSet up absolute references for create_engine and related
Mike Bayer [Tue, 14 Apr 2020 20:39:42 +0000 (16:39 -0400)] 
Set up absolute references for create_engine and related

includes more replacements for create_engine(), Connection,
disambiguation of Result from future/baked

Change-Id: Icb60a79ee7a6c45ea9056c211ffd1be110da3b5e

5 years agoMerge "Run search and replace of symbolic module names"
mike bayer [Tue, 14 Apr 2020 19:48:20 +0000 (19:48 +0000)] 
Merge "Run search and replace of symbolic module names"