]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/log
thirdparty/sqlalchemy/sqlalchemy.git
5 years agofixed typo in session.py in line 3063 4958/head
L0stLink [Sat, 2 Nov 2019 10:09:03 +0000 (15:09 +0500)] 
fixed typo in session.py in line 3063

Changed : wish to detect is a "rollback" is
 to : wish to detect if a "rollback" is
, improving clarity.

5 years agoMerge "Cache every key in reflection_cache"
mike bayer [Thu, 31 Oct 2019 15:56:02 +0000 (15:56 +0000)] 
Merge "Cache every key in reflection_cache"

5 years agoMerge "omit_join=True is not supported"
mike bayer [Thu, 31 Oct 2019 15:55:23 +0000 (15:55 +0000)] 
Merge "omit_join=True is not supported"

5 years agoImprove SQL Server pyodbc documentation
Mike Bayer [Thu, 31 Oct 2019 14:30:46 +0000 (10:30 -0400)] 
Improve SQL Server pyodbc documentation

While we were told years ago that ODBC is intended to be used with
DSNs only, however this use does not correspond well with how most
other database connectivity systems work in that modern systems
already have their own registries of connection information in any
case, meaning this is usually the best place to add details such
as hostnames and driver names, rather than having them locked away
in a server-specific ODBC registry.    So here we dial back the
language that one style or another of connecting is "preferred";
both styles are supported equally, and the critical advantage of
hostname mapping in that the target database name is both explicit
as well as modifyable is also added.

Add additional background for how DSNs work and refine other
sentences.   "URL encoding" is the correct terminology for
adding spaces and special characters to a URL.

Change-Id: I13a74432976e6d3166633b98f9bb84c4856caac8

5 years agoMerge "Remove python setup.py test; fix SQL Server URL"
mike bayer [Thu, 31 Oct 2019 14:23:21 +0000 (14:23 +0000)] 
Merge "Remove python setup.py test; fix SQL Server URL"

5 years agoCache every key in reflection_cache
Mike Bayer [Thu, 31 Oct 2019 13:30:12 +0000 (09:30 -0400)] 
Cache every key in reflection_cache

Fixed bug in :class:`.Inspector` where the cache key generation did not
take into account arguments passed in the form of tuples, such as the tuple
of view name styles to return for the PostgreSQL dialect. This would lead
the inspector to cache too generally for a more specific set of criteria.
The logic has been adjusted to include every keyword element in the cache,
as every argument is expected to be appropriate for a cache else the
caching decorator should be bypassed by the dialect.

Fixes: #4955
Change-Id: Icd97744323407977a3f7db26e8a63a1a5c576010

5 years agoomit_join=True is not supported
Mike Bayer [Wed, 30 Oct 2019 18:42:10 +0000 (14:42 -0400)] 
omit_join=True is not supported

The :paramref:`.relationship.omit_join` flag was not intended to be
manually set to True, and will now emit a warning when this occurs.  The
omit_join optimization is detected automatically, and the ``omit_join``
flag was only intended to disable the optimization in the hypothetical case
that the optimization may have interfered with correct results, which has
not been observed with the modern version of this feature.   Setting the
flag to True when it is not automatically detected may cause the selectin
load feature to not work correctly when a non-default primary join
condition is in use.

Fixes: #4954
Change-Id: I3afebefb13ddaf8f74c5c2b9e6e6a1a261ac5629

5 years agoMerge "Correctly interpret None passed to query.get(); warn for empty PK values"
mike bayer [Wed, 30 Oct 2019 18:20:06 +0000 (18:20 +0000)] 
Merge "Correctly interpret None passed to query.get(); warn for empty PK values"

5 years agoMerge "Remove redundant assignment in .../engine/create.py"
mike bayer [Wed, 30 Oct 2019 18:19:06 +0000 (18:19 +0000)] 
Merge "Remove redundant assignment in .../engine/create.py"

5 years agoMerge "Use simple growth scale with any max size for BufferedRowResultProxy"
mike bayer [Wed, 30 Oct 2019 18:18:48 +0000 (18:18 +0000)] 
Merge "Use simple growth scale with any max size for BufferedRowResultProxy"

5 years agoUse simple growth scale with any max size for BufferedRowResultProxy
sumau [Mon, 28 Oct 2019 19:22:08 +0000 (15:22 -0400)] 
Use simple growth scale with any max size for BufferedRowResultProxy

The maximum buffer size for the :class:`.BufferedRowResultProxy`, which
is used by dialects such as PostgreSQL when ``stream_results=True``, can
now be set to a number greater than 1000 and the buffer will grow to
that size.  Previously, the buffer would not go beyond 1000 even if the
value were set larger.   The growth of the buffer is also now based
on a simple multiplying factor currently set to 5.  Pull request courtesy
Soumaya Mauthoor.

Fixes: #4914
Closes: #4930
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4930
Pull-request-sha: 66841f56e967c784f7078a787cec5129462006c8

Change-Id: I6286220bd9d488027fadc444039421a410e19a19

5 years agoCorrectly interpret None passed to query.get(); warn for empty PK values
lizraeli [Mon, 28 Oct 2019 19:33:41 +0000 (15:33 -0400)] 
Correctly interpret None passed to query.get(); warn for empty PK values

A warning is emitted if a primary key value is passed to :meth:`.Query.get`
that consists of None for all primary key column positions.   Previously,
passing a single None outside of a tuple would raise a ``TypeError`` and
passing a composite None (tuple of None values) would silently pass
through.   The fix now coerces the single None into a tuple where it is
handled consistently with the other None conditions.  Thanks to Lev
Izraelit for the help with this.

Fixes #4915
Closes: #4917
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4917
Pull-request-sha: b388343c7cabeecf8c779689b78e638c23f9af40

Change-Id: Ibc6c27ccf50dfd4adbf15b6dbd393115c30d44fb

5 years agoMerge remote-tracking branch 'origin/pr/4940'
Mike Bayer [Mon, 28 Oct 2019 19:28:46 +0000 (15:28 -0400)] 
Merge remote-tracking branch 'origin/pr/4940'

Change-Id: Id88c540fab045f800818c40b7a8f7a20920ab9a6

5 years agoRemove redundant assignment in .../engine/create.py
Pedro Cunial [Mon, 28 Oct 2019 19:27:44 +0000 (15:27 -0400)] 
Remove redundant assignment in .../engine/create.py

<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
<!-- Describe your changes in detail -->

Remove a redundant assignment in the engine creation file.

### 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:

- [x] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [ ] 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.

**Have a nice day!**

Closes: #4944
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4944
Pull-request-sha: 4a0e6206f0ae5ff5350ecaa6f998bc3dc0c26cdd

Change-Id: Ie491b071e3392334947d3b8ba84c7323c1b15b6e

5 years agoSquashed commit of the following:
Mike Bayer [Mon, 28 Oct 2019 19:24:56 +0000 (15:24 -0400)] 
Squashed commit of the following:

commit 358500f542c3a8c707222bd2fea9478258b3d8d3
Author: Daniel Gaspar <danielvazgaspar@gmail.com>
Date:   Fri Oct 25 09:39:41 2019 +0100

    [docs] Fix, typo

commit b68127b842849ffcc19c311e4b9b4afcc16395ca
Author: Daniel Gaspar <danielvazgaspar@gmail.com>
Date:   Fri Oct 25 09:29:43 2019 +0100

    [docs] Elasticsearch dialect and dbapi

Change-Id: I5c67eca606be382f801facae3546ab6c499e9e63

5 years agoRemove python setup.py test; fix SQL Server URL
Mike Bayer [Tue, 22 Oct 2019 22:40:41 +0000 (18:40 -0400)] 
Remove python setup.py test; fix SQL Server URL

general README.unittest.rst edits

Fixes: #4789
Fixes: #4900
Change-Id: Ifddd3bfd1e6a4d24d3b0a3e1702e04e66a42a4dd

5 years agoMerge "Add public accessor `is_single_entity` to Query"
mike bayer [Mon, 28 Oct 2019 12:46:37 +0000 (12:46 +0000)] 
Merge "Add public accessor `is_single_entity` to Query"

5 years agoAdd public accessor `is_single_entity` to Query
Patrick Hayes [Thu, 24 Oct 2019 14:11:52 +0000 (10:11 -0400)] 
Add public accessor `is_single_entity` to Query

Added accessor :attr:`.Query.is_single_entity` to :class:`.Query`, which
will indicate if the results returned by this :class:`.Query` will be a
list of ORM entities, or a tuple of entities or column expressions.
SQLAlchemy hopes to improve upon the behavior of single entity / tuples in
future releases such that the behavior would be explicit up front, however
this attribute should be helpful with the current behavior.  Pull request
courtesy Patrick Hayes.

Fixes: #4934
Closes: #4935
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4935
Pull-request-sha: 98f72b40a896761a65b048cc3722ff2dac4cf2b1

Change-Id: If5db5db3ea46a93406d76ef90b5b588149ba2986

5 years agoMerge "Don't cache a query that has before_compile modifications"
mike bayer [Sun, 27 Oct 2019 15:05:46 +0000 (15:05 +0000)] 
Merge "Don't cache a query that has before_compile modifications"

5 years agoDon't cache a query that has before_compile modifications
Mike Bayer [Fri, 25 Oct 2019 15:34:37 +0000 (11:34 -0400)] 
Don't cache a query that has before_compile modifications

The :class:`.BakedQuery` will not cache a query that was modified by a
:meth:`.QueryEvents.before_compile` event, so that compilation hooks that
may be applying ad-hoc modifications to queries will take effect on each
run.  In particular this is helpful for events that modify queries used in
lazy loading as well as eager loading such as "select in" loading.  In
order to re-enable caching for a query modified by this event, a new
flag ``bake_ok`` is added; see :ref:`baked_with_before_compile` for
details.

A longer term plan to provide a new form of SQL caching should solve this
kind of issue more comprehensively.

Fixes: #4947
Change-Id: I5823c4fa00e7b6d46a2e8461b02d8b16605a6ed0

5 years agoMerge "Fix Python 3.8 SyntaxWarning: "is not" with a literal"
mike bayer [Sat, 26 Oct 2019 13:58:52 +0000 (13:58 +0000)] 
Merge "Fix Python 3.8 SyntaxWarning: "is not" with a literal"

5 years agoPerform an active check for sqlite json extension
Mike Bayer [Fri, 25 Oct 2019 17:10:30 +0000 (13:10 -0400)] 
Perform an active check for sqlite json extension

Apparently some Python builds may not have json enabled
for sqlite even though version > 3.9, add an active check
for the json functions.

Fixes: #4946
Change-Id: I1a1ce7ef72da8da9ad9576e1281d1df415c6af4f

5 years agoMerge "Disallow memory tests from running on Windows"
mike bayer [Fri, 25 Oct 2019 16:31:49 +0000 (16:31 +0000)] 
Merge "Disallow memory tests from running on Windows"

5 years agoWarn that before_compile for lazyload needs bake_queries=False
Mike Bayer [Fri, 25 Oct 2019 14:08:18 +0000 (10:08 -0400)] 
Warn that before_compile for lazyload needs bake_queries=False

The longer term future plan for ORM queries is that there
will be a new hook that receives queries before invocation
rather than "compilation", which will make use of a new
caching system.

Fixes: #4947
Change-Id: I256c16155a0cc9b7133e86e22d27040cb64eb1a9

5 years agoDisallow memory tests from running on Windows
Mike Bayer [Fri, 25 Oct 2019 02:29:28 +0000 (22:29 -0400)] 
Disallow memory tests from running on Windows

These tests fail with multiprocess errors involving pickling
of the profile file.  The memory tests are not critical
for windows development nor are the profiling tests overall
as they are against platform independent measurements.

Fixes: #4946
Change-Id: Iaeb3958e59ce7709ba6af3cf9d7baf2a4922bb9b

5 years agoFix Python 3.8 SyntaxWarning: "is not" with a literal
Anders Kaseorg [Thu, 24 Oct 2019 18:27:57 +0000 (14:27 -0400)] 
Fix Python 3.8 SyntaxWarning: "is not" with a literal

### Description

Fixes this warning from Python 3.8 in `Query._set_entities`:

```
lib/sqlalchemy/orm/query.py:179: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if entities is not ():
```

Fixes #4938.

### Checklist

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.

**Have a nice day!**

Closes: #4939
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4939
Pull-request-sha: 88167460ced7f576a9aed3d0ff0a6e7e18810004

Change-Id: I21464c3e69b4db6307db99f9ccb9b34bbac4e744

5 years agoMerge "Use default repr() for quoted_name under python 3"
mike bayer [Thu, 24 Oct 2019 15:31:51 +0000 (15:31 +0000)] 
Merge "Use default repr() for quoted_name under python 3"

5 years agoMerge "Document unique bound parameters for text()"
mike bayer [Thu, 24 Oct 2019 14:17:33 +0000 (14:17 +0000)] 
Merge "Document unique bound parameters for text()"

5 years agoUse default repr() for quoted_name under python 3
Mike Bayer [Wed, 23 Oct 2019 14:53:04 +0000 (10:53 -0400)] 
Use default repr() for quoted_name under python 3

Changed the ``repr()`` of the :class:`.quoted_name` construct to use
regular string repr() under Python 3, rather than running it through
"backslashreplace" escaping, which can be misleading.

Modified the approach of "name normalization" for the Oracle and Firebird
dialects, which converts from the UPPERCASE-as-case-insensitive convention
of these dialects into lowercase-as-case-insensitive for SQLAlchemy, to not
automatically apply the :class:`.quoted_name` construct to a name that
matches itself under upper or lower case conversion, as is the case for
many non-european characters.   All names used within metadata structures
are converted to :class:`.quoted_name` objects in any case; the change
here would only affect the output of some inspection functions.

Moved name normalize to be under default dialect, added test coverage
in test/sql/test_quote.py

Fixes: #4931
Change-Id: Ic121b20e07249824710a54423e321d94a425362f

5 years agoMerge "Refactor dialect tests for combinations"
mike bayer [Wed, 23 Oct 2019 18:13:40 +0000 (18:13 +0000)] 
Merge "Refactor dialect tests for combinations"

5 years agoDocument unique bound parameters for text()
Mike Bayer [Wed, 23 Oct 2019 17:03:09 +0000 (13:03 -0400)] 
Document unique bound parameters for text()

Will backport the feature from part of 36e8fe4 / #4808 to
1.3.

Fixes: #4933
Change-Id: Ide4069ff5cccd5ed83a5f314e5f21e51dfe08b7d

5 years agoTypo fix 4940/head
Ales Dokshanin [Wed, 23 Oct 2019 15:37:49 +0000 (18:37 +0300)] 
Typo fix

5 years agoAdd doc note for multiple table mapping
Mike Bayer [Wed, 23 Oct 2019 15:18:56 +0000 (11:18 -0400)] 
Add doc note for multiple table mapping

When mapping to a construct like OUTER JOIN, an UPDATE from the
ORM expects that all involved tables have a row already present;
document this as well as a potential workaround.

Fixes: #4927
Change-Id: Ie99f9f53cea33d9df2513f384a7c68676b197fb7

5 years agoRefactor dialect tests for combinations
Mike Bayer [Mon, 21 Oct 2019 21:32:04 +0000 (17:32 -0400)] 
Refactor dialect tests for combinations

Dialect tests tend to have a lot of lists of types,
SQL constructs etc, convert as many of these to @combinations
as possible.

This is exposing that we don't have per-combination
exclusion rules set up which is making things a little bit
cumbersome.

Also set up a fixture that does metadata + DDL.

Change-Id: Ief820e48c9202982b0b1e181b87862490cd7b0c3

5 years agoImplment encoding_errors for cx_oracle
Mike Bayer [Mon, 12 Aug 2019 19:09:37 +0000 (15:09 -0400)] 
Implment encoding_errors for cx_oracle

Added dialect-level flag ``encoding_errors`` to the cx_Oracle dialect,
which can be specified as part of :func:`.create_engine`.   This is passed
to SQLAlchemy's unicode decoding converter under Python 2, and to
cx_Oracle's ``cursor.var()`` object as the ``encodingErrors`` parameter
under Python 3, for the very unusual case that broken encodings are present
in the target database which cannot be fetched unless error handling is
relaxed.  The value is ultimately one of the Python "encoding errors"
parameters passed to ``decode()``.

Closes: #4801
Fixes: #4799
Change-Id: I1d542ba367bcd187347c54db1fee815f7890e71c

5 years agoMerge "Ensure SQL Server default schema name not interpreted as dot-separated tokens"
mike bayer [Mon, 21 Oct 2019 14:55:58 +0000 (14:55 +0000)] 
Merge "Ensure SQL Server default schema name not interpreted as dot-separated tokens"

5 years agoImplement facade for pytest parametrize, fixtures, classlevel
Mike Bayer [Thu, 17 Oct 2019 17:09:24 +0000 (13:09 -0400)] 
Implement facade for pytest parametrize, fixtures, classlevel

Add factilities to implement pytest.mark.parametrize and
pytest.fixtures patterns, which largely resemble things we are
already doing.

Ensure a facade is used, so that the test suite remains independent
of py.test, but also tailors the functions to the more limited
scope in which we are using them.

Additionally, create a class-based version that works from the
same facade.

Several old polymorphic tests as well as two of the sql test
are refactored to use the new features.

Change-Id: I6ef8af1dafff92534313016944d447f9439856cf
References: #4896

5 years agoMerge "add on_connect to MySQLDialect_pyodbc"
mike bayer [Sun, 20 Oct 2019 15:27:16 +0000 (15:27 +0000)] 
Merge "add on_connect to MySQLDialect_pyodbc"

5 years agoMerge remote-tracking branch 'origin/pr/4929'
Mike Bayer [Sun, 20 Oct 2019 15:16:57 +0000 (11:16 -0400)] 
Merge remote-tracking branch 'origin/pr/4929'

Change-Id: Ic222f770ac97a7b415bf4137fb9e6b742609f20d

5 years agoMerge remote-tracking branch 'origin/pr/4899'
Mike Bayer [Sun, 20 Oct 2019 15:11:31 +0000 (11:11 -0400)] 
Merge remote-tracking branch 'origin/pr/4899'

Change-Id: Ie25f79c8845d58ef445b1042861f6735c1d86b7e

5 years agoadd on_connect to MySQLDialect_pyodbc
Gord Thompson [Sun, 20 Oct 2019 15:04:51 +0000 (11:04 -0400)] 
add on_connect to MySQLDialect_pyodbc

Fixes: #4876
<!-- Provide a general summary of your proposed changes in the Title field above -->

### Description
add on_connect to MySQLDialect_pyodbc to specify Unicode encoding/decoding settings for the pyodbc connection

### 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.

**Have a nice day!**

Closes: #4885
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4885
Pull-request-sha: 58f6176331702b72f3ea8342c93be6fe9a3db26f

Change-Id: If05c1cf8fb1d8efebcf809bdefe40242118d763f

5 years agoMerge remote-tracking branch 'origin/pr/4918'
Mike Bayer [Sun, 20 Oct 2019 15:01:43 +0000 (11:01 -0400)] 
Merge remote-tracking branch 'origin/pr/4918'

Change-Id: Ic4e3ff2a4fbc62871771451e3859f2e5f7c5abce

5 years ago- fix typo 4929/head
Heckad [Sat, 19 Oct 2019 13:12:58 +0000 (16:12 +0300)] 
- fix typo

5 years ago- add plugins for flake8 pre-commit hook
Mike Bayer [Fri, 18 Oct 2019 14:27:25 +0000 (10:27 -0400)] 
- add plugins for flake8 pre-commit hook

Change-Id: I18111dfb9915ec6002cd0b66be5d256c2e33a37f

5 years agoEnsure SQL Server default schema name not interpreted as dot-separated tokens
Mike Bayer [Fri, 18 Oct 2019 01:29:51 +0000 (21:29 -0400)] 
Ensure SQL Server default schema name not interpreted as dot-separated tokens

Fixed an issue in the :meth:`.Engine.table_names` method where it would
feed the dialect's default schema name back into the dialect level table
function, which in the case of SQL Server would interpret it as a
dot-tokenized schema name as viewed by the mssql dialect, which would
cause the method to fail in the case where the database username actually
had a dot inside of it.  In 1.3, this method is still used by the
:meth:`.MetaData.reflect` function so is a prominent codepath. In 1.4,
which is the current master development branch, this issue doesn't exist,
both because :meth:`.MetaData.reflect` isn't using this method nor does the
method pass the default schema name explicitly.  The fix nonetheless
guards against the default server name value returned by the dialect from
being interpreted as dot-tokenized name under any circumstances by
wrapping it in quoted_name().

Fixes: #4923
Change-Id: I821bd38ed89b767eaca0bdffee7f8ba3baf82560

5 years agoFix test failures from func doc fix
Mike Bayer [Fri, 18 Oct 2019 02:11:31 +0000 (22:11 -0400)] 
Fix test failures from func doc fix

The doc edits in e45878bf4f9cdfb714dce8b2a4d705178947674d
triggered a doctest and a pep8 failure.

Change-Id: I41c6cba9bab2d3721d9c6280be47eec32f4b4736

5 years agofix func docs
Mike Bayer [Thu, 17 Oct 2019 19:04:47 +0000 (15:04 -0400)] 
fix func docs

sphinx is not generating the docs for func.  cross-copy
__doc__ and also add more links.

Fixes: #4922
Change-Id: I5512111d726b6fcf9821be730c9e29adc73c95cb

5 years agoUpgrade for python 3.8
Mike Bayer [Thu, 17 Oct 2019 12:45:03 +0000 (08:45 -0400)] 
Upgrade for python 3.8

- remove pymssql again, there are no py38 builds and the project
seems stalled again

- ideally we would have no pyenvs listed out for tox but for now
add py38

Change-Id: Iee2e3da96d2d0e4357aaf2ade735c4b8300c3c12

5 years agoFix pydoc typo in sqlite dialect 4918/head
Matt Livesey [Thu, 17 Oct 2019 07:36:30 +0000 (09:36 +0200)] 
Fix pydoc typo in sqlite dialect

5 years agoMerge remote-tracking branch 'origin/pr/4906'
Mike Bayer [Wed, 16 Oct 2019 20:14:14 +0000 (16:14 -0400)] 
Merge remote-tracking branch 'origin/pr/4906'

Change-Id: I888a80258fc1027f6606ed0d4f6e87c055e676c2

5 years ago- fix doc typos
Mike Bayer [Wed, 16 Oct 2019 20:12:46 +0000 (16:12 -0400)] 
- fix doc typos

Change-Id: Icc0ea0ac5392969927bec9a33418fd64a43a40b2

5 years ago- fix typo
Mike Bayer [Wed, 16 Oct 2019 19:13:24 +0000 (15:13 -0400)] 
- fix typo

Change-Id: Ic6d31cb4323a3446c857640dd4fbe5057a7508d7

5 years agoImplement raiseload for deferred columns
Mike Bayer [Fri, 11 Oct 2019 18:45:24 +0000 (14:45 -0400)] 
Implement raiseload for deferred columns

Added "raiseload" feature for ORM mapped columns.

As part of this change, the behavior of "deferred" is now more strict;
an attribute that is set up as "deferred" at the mapper level no longer
participates in an "unexpire" operation; that is, when an unexpire loads
all the expired columns of an object which are not themselves in a deferred
group, those which are mapper-level deferred will never be loaded.

Deferral options set at query time should always be reset by an expiration
operation.

Renames deferred_scalar_loader to expired_attribute_loader

Unfortunately we can't have raiseload() do this because it would break
existing wildcard behavior.

Fixes: #4826
Change-Id: I30d9a30236e0b69134e4094fb7c1ad2267f089d1

5 years agoMerge "Use cx_Oracle.FIXED_NCHAR for sqltypes.NCHAR"
mike bayer [Tue, 15 Oct 2019 19:38:51 +0000 (19:38 +0000)] 
Merge "Use cx_Oracle.FIXED_NCHAR for sqltypes.NCHAR"

5 years agoUse cx_Oracle.FIXED_NCHAR for sqltypes.NCHAR
Mike Bayer [Tue, 15 Oct 2019 01:53:44 +0000 (21:53 -0400)] 
Use cx_Oracle.FIXED_NCHAR for sqltypes.NCHAR

The :class:`.sqltypes.NCHAR` datatype will now bind to the
``cx_Oracle.FIXED_NCHAR`` DBAPI data bindings when used in a bound
parameter, which supplies proper comparison behavior against a
variable-length string.  Previously, the :class:`.sqltypes.NCHAR` datatype
would bind to ``cx_oracle.NCHAR`` which is not fixed length; the
:class:`.sqltypes.CHAR` datatype already binds to ``cx_Oracle.FIXED_CHAR``
so it is now consistent that :class:`.sqltypes.NCHAR` binds to
``cx_Oracle.FIXED_NCHAR``.

Fixes: #4913
Change-Id: I5bb111f2e06bbdd525bc5f716579baad31bbb3db

5 years agoClarify isolation_level documentation
Mike Bayer [Tue, 15 Oct 2019 15:27:51 +0000 (11:27 -0400)] 
Clarify isolation_level documentation

Fixes: #4909
Change-Id: I32114a8349c1d2d0a837610ccc74f9e789ed20f5

5 years agoMerge "Use separate label generator for column_label naming convention"
mike bayer [Mon, 14 Oct 2019 19:22:47 +0000 (19:22 +0000)] 
Merge "Use separate label generator for column_label naming convention"

5 years agoMerge remote-tracking branch 'origin/pr/4908'
Mike Bayer [Mon, 14 Oct 2019 16:57:46 +0000 (12:57 -0400)] 
Merge remote-tracking branch 'origin/pr/4908'

Change-Id: Ifc32aff1f2b0d4b0c330476ca1fc2f3292fda46f

5 years agoUse separate label generator for column_label naming convention
Mike Bayer [Mon, 14 Oct 2019 00:33:24 +0000 (20:33 -0400)] 
Use separate label generator for column_label naming convention

Fixed bug where a table that would have a column label overlap with a plain
column name, such as "foo.id AS foo_id" vs. "foo.foo_id", would prematurely
generate the ``._label`` attribute for a column before this overlap could
be detected due to the use of the ``index=True`` or ``unique=True`` flag on
the column in conjunction with the default naming convention of
``"column_0_label"``.  This would then lead to failures when ``._label``
were used later to generate a bound parameter name, in particular those
used by the ORM when generating the WHERE clause for an UPDATE statement.
The issue has been fixed by using an alternate ``._label`` accessor for DDL
generation that does not affect the state of the :class:`.Column`.   The
accessor also bypasses the key-deduplication step as it is not necessary
for DDL, the naming is now consistently ``"<tablename>_<columnname>"``
without any subsequent numeric symbols when used in DDL.

Fixes: #4911
Change-Id: Iabf5fd3250738d800d6e41a2a3a27a7ce2405e7d

5 years agoAdd _alembic_quote method to format_constraint()
Mike Bayer [Mon, 14 Oct 2019 03:02:22 +0000 (23:02 -0400)] 
Add _alembic_quote method to format_constraint()

Alembic needs a portable way of getting at the name of an
index without quoting being applied.   As we would like the
indexes created by the Column index=True flag to support
deferred index names, supply a function that delivers this
for Alembic without it having to dig too deeply into the
internals.    the _alembic_quote flag may be made public
at a later time, however as we've been through many quoting
flags that are difficult to get rid of, try to be conservative
to start.

Change-Id: I184adaeae26c2e75093aaea5ebe01a3815cadb08

5 years ago- add flake8 as a pre commit hook
Mike Bayer [Sun, 13 Oct 2019 22:56:25 +0000 (18:56 -0400)] 
- add flake8 as a pre commit hook

Change-Id: Ie9187b9aac636b198df39428cdcb4bcf6f819879

5 years agolink to Google BigQuery dialect 4908/head
Aidan Feldman [Sat, 12 Oct 2019 02:52:28 +0000 (22:52 -0400)] 
link to Google BigQuery dialect

5 years agoMerge "Remove deprecated elements"
mike bayer [Fri, 11 Oct 2019 18:20:30 +0000 (18:20 +0000)] 
Merge "Remove deprecated elements"

5 years agoMerge "Omit onclause as source of FROMs from a Join"
mike bayer [Fri, 11 Oct 2019 17:33:48 +0000 (17:33 +0000)] 
Merge "Omit onclause as source of FROMs from a Join"

5 years agoMerge "added additional error message to is_disconnect() for Firebird dialects"
mike bayer [Fri, 11 Oct 2019 17:30:23 +0000 (17:30 +0000)] 
Merge "added additional error message to is_disconnect() for Firebird dialects"

5 years agoRemove deprecated elements
Asif Saif Uddin (Auvi) [Sun, 6 Oct 2019 16:32:10 +0000 (12:32 -0400)] 
Remove deprecated elements

Includes:

PassiveDefault
SchemaItem.quote
Table.useexisting
Table.quote_schema
Table.append_ddl_listener
MetaData.append_ddl_listener
Metadata.reflect kw parameter (use reflect() method)
DDL.execute_at
DDL.on

Partially-fixes: #4643
Closes: #4893
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4893
Pull-request-sha: 860eb6a253fe4a95685b4f5f3349b19823a304f3

Change-Id: I0f5b8a873e7581365ff8dba48eab358d9e8e7b13

5 years agoMerge "pass executemany context to _repr_params"
mike bayer [Fri, 11 Oct 2019 17:27:55 +0000 (17:27 +0000)] 
Merge "pass executemany context to _repr_params"

5 years agopass executemany context to _repr_params
Mike Bayer [Wed, 9 Oct 2019 17:55:19 +0000 (13:55 -0400)] 
pass executemany context to _repr_params

Fixed bug where parameter repr as used in logging and error reporting needs
additional context in order to distinguish between a list of parameters for
a single statement and a list of parameter lists, as the "list of lists"
structure could also indicate a single parameter list where the first
parameter itself is a list, such as for an array parameter.   The
engine/connection now passes in an additional boolean indicating how the
parameters should be considered.  The only SQLAlchemy backend that expects
arrays as parameters is that of  psycopg2 which uses pyformat parameters,
so this issue has not been too apparent, however as other drivers that use
positional gain more features it is important that this be supported. It
also eliminates the need for the parameter repr function to guess based on
the parameter structure passed.

Fixes: #4902
Change-Id: I086246ee0eb51484adbefd83e07295fa56576c5f

5 years agoadded additional error message to is_disconnect() for Firebird dialects
lukens [Thu, 10 Oct 2019 16:06:15 +0000 (12:06 -0400)] 
added additional error message to is_disconnect() for Firebird dialects

Added additional "disconnect" message "Error writing data to the
connection" to Firebird disconnection detection.  Pull request courtesy
lukens.

Fixes: #4903
Closes: #4904
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4904
Pull-request-sha: c56d7c4abf6b6c8263efaf070b4e7a319e12a875

Change-Id: Ib70c20c616e7519b933fee587a3b3e8dbb4c2f81

5 years ago.gitignore test files and PyCharm venv folder 4906/head
Gord Thompson [Thu, 10 Oct 2019 19:34:32 +0000 (13:34 -0600)] 
.gitignore test files and PyCharm venv folder

Excludes:
- PyCharm /venv/ virtualenv folder
- leftover .db files from (failed?) test runs
- /test.cfg file for customizing test configuration

5 years agocherry-pick changelog update for 1.3.11
Mike Bayer [Thu, 10 Oct 2019 00:34:13 +0000 (20:34 -0400)] 
cherry-pick changelog update for 1.3.11

5 years agocherry-pick changelog from 1.3.10
Mike Bayer [Thu, 10 Oct 2019 00:34:12 +0000 (20:34 -0400)] 
cherry-pick changelog from 1.3.10

5 years agoRepair Oracle compat version check; dont warn if failed
Mike Bayer [Wed, 9 Oct 2019 20:05:34 +0000 (16:05 -0400)] 
Repair Oracle compat version check; dont warn if failed

Fixed regression in Oracle dialect that was inadvertently using max
identifier length of 128 characters on Oracle server 12.2 and greater even
though the stated contract for the remainder of the 1.3 series is  that
this value stays at 30 until version SQLAlchemy 1.4.  Also repaired issues
with the retrieval of the "compatibility" version, and removed the warning
emitted when the "v$parameter" view was not accessible as this was  causing
user confusion.

Fixes: #4898
Change-Id: Ieb7b3e093610896c5aa12d0789b63262e0ecf9d8

5 years agoOmit onclause as source of FROMs from a Join
Mike Bayer [Tue, 8 Oct 2019 20:42:21 +0000 (16:42 -0400)] 
Omit onclause as source of FROMs from a Join

The :class:`.Join` construct no longer considers the "onclause" as a source
of additional FROM objects to be omitted from the FROM list of an enclosing
:class:`.Select` object as standalone FROM objects. This applies to an ON
clause that includes a reference to another  FROM object outside the JOIN;
while this is usually not correct from a SQL perspective, it's also
incorrect for it to be omitted, and the behavioral change makes the
:class:`.Select` / :class:`.Join` behave a bit more intuitively.

Fixes: #4621
Change-Id: Iaa1e75b7c59b21e9701ab3c9b69e66930feaf8ee

5 years agolist sqlalchemy-access as external dialect
Gord Thompson [Tue, 8 Oct 2019 12:27:05 +0000 (06:27 -0600)] 
list sqlalchemy-access as external dialect

5 years agoMerge "fix error in test_round_trip for TimeTest with mysql+pyodbc"
mike bayer [Tue, 8 Oct 2019 19:44:12 +0000 (19:44 +0000)] 
Merge "fix error in test_round_trip for TimeTest with mysql+pyodbc"

5 years agofix supports_unicode_statements for mysql+pyodbc 4899/head
Gord Thompson [Tue, 1 Oct 2019 22:50:27 +0000 (16:50 -0600)] 
fix supports_unicode_statements for mysql+pyodbc

Fixes: #4881
5 years agoMerge "Add result map targeting for custom compiled, text objects"
mike bayer [Tue, 8 Oct 2019 15:23:51 +0000 (15:23 +0000)] 
Merge "Add result map targeting for custom compiled, text objects"

5 years agoAdd result map targeting for custom compiled, text objects
Mike Bayer [Thu, 3 Oct 2019 21:36:27 +0000 (17:36 -0400)] 
Add result map targeting for custom compiled, text objects

In order for text(), custom compiled objects, etc. to be usable
by Query(), they are all targeted by object key in the result map.
As we no longer want Query to implicitly label these, as well as that
text() has no label feature, support adding entries to the result
map that have no name, key, or type, only the object itself, and
then ensure that the compiler sets up for positional targeting
when this condition is detected.

Allows for more flexible ORM query usage with custom expressions
and text() while having less special logic in query itself.

Fixes: #4887
Change-Id: Ie073da127d292d43cb132a2b31bc90af88bfe2fd

5 years agoMerge "Fix max_identifier_length for SQL server"
mike bayer [Mon, 7 Oct 2019 21:04:49 +0000 (21:04 +0000)] 
Merge "Fix max_identifier_length for SQL server"

5 years agoRestore result map check
Mike Bayer [Mon, 7 Oct 2019 20:29:12 +0000 (16:29 -0400)] 
Restore result map check

Was mistakenly removed just now in c4dcf3dda63bfd9254ac5864cc

Change-Id: I84998b6c45cf6b84502eabb3166984dd02fb00d8

5 years agoMerge "Drop right-nested join rewriting"
mike bayer [Mon, 7 Oct 2019 20:27:19 +0000 (20:27 +0000)] 
Merge "Drop right-nested join rewriting"

5 years agoRemove order_by in textual test
Mike Bayer [Mon, 7 Oct 2019 20:18:41 +0000 (16:18 -0400)] 
Remove order_by in textual test

Fixes for SQL server

Change-Id: I089bb9d400fb1b0708340792c3840e44bffa37e4

5 years agoFix max_identifier_length for SQL server
Mike Bayer [Mon, 7 Oct 2019 20:12:30 +0000 (16:12 -0400)] 
Fix max_identifier_length for SQL server

Fixed bug in SQL Server dialect with new "max_identifier_length" feature
where the mssql dialect already featured this flag, and the implementation
did not accommodate for the new initialization hook correctly.

Fixes: #4857
Change-Id: I96a9c6ca9549d8f6fb167c0333f684e8d922a3bf

5 years agoDrop right-nested join rewriting
Mike Bayer [Mon, 7 Oct 2019 19:25:27 +0000 (15:25 -0400)] 
Drop right-nested join rewriting

Dropped support for right-nested join rewriting to support old SQLite
versions prior to 3.7.16, released in 2013.   It is expected that
all modern Python versions among those now supported should all include
much newer versions of SQLite.

Fixes: #4895
Change-Id: I7f0cfc2b7d988ff147b9a4c6d5e2adec87e27029

5 years agoMerge "create second level deduping when use_labels is turned on"
mike bayer [Mon, 7 Oct 2019 18:28:07 +0000 (18:28 +0000)] 
Merge "create second level deduping when use_labels is turned on"

5 years agocreate second level deduping when use_labels is turned on
Mike Bayer [Sat, 5 Oct 2019 22:27:44 +0000 (18:27 -0400)] 
create second level deduping when use_labels is turned on

As of #4753 we allow duplicate columns.  This creates some new
problems that there can be duplicate columns in a subquery
which are then not addressible on the outside because they
are ambiguous (Postgresql has this behavior at least).  Additionally
it creates situations where we are making an anon label of an
anon label which is leaking into the query.

New logic for generating anon labels handles this situation and
also alters the .c collection
of a subquery such that we are only getting the first column
from the derived selectable that has that name, the subsequent ones
have a new deduping label with two underscores and are not exposed
in .c.  The dedupe logic when rendering the columns will handle
duplicate label names for different columns, vs. the same column
repeated, as separate cases.

Fixes: #4892
Change-Id: I929fbd8da14bcc239e0481c24bbd9b5ce826e8fa

5 years agoRemove deprecated extension and similar classes
Mike Bayer [Sun, 6 Oct 2019 01:28:48 +0000 (21:28 -0400)] 
Remove deprecated extension and similar classes

All long-deprecated "extension" classes have been removed, including
MapperExtension, SessionExtension, PoolListener, ConnectionProxy,
AttributExtension.  These classes have been deprecated since version 0.7
long superseded by the event listener system.

Fixes: #4638
Change-Id: If4156d4956b10847bd93b6408a7c52ff5168db9b

5 years agoMerge "Deprecate textual column matching in Row"
mike bayer [Sat, 5 Oct 2019 00:05:33 +0000 (00:05 +0000)] 
Merge "Deprecate textual column matching in Row"

5 years agocherry-pick changelog update for 1.3.10
Mike Bayer [Fri, 4 Oct 2019 20:17:23 +0000 (16:17 -0400)] 
cherry-pick changelog update for 1.3.10

5 years agocherry-pick changelog from 1.3.9
Mike Bayer [Fri, 4 Oct 2019 20:17:22 +0000 (16:17 -0400)] 
cherry-pick changelog from 1.3.9

5 years ago- fix typo
Mike Bayer [Fri, 4 Oct 2019 20:06:28 +0000 (16:06 -0400)] 
- fix typo

Change-Id: I8275a9cbb9a664badbaf759ec62399ac0ead9b20

5 years agoDeprecate textual column matching in Row
Mike Bayer [Tue, 1 Oct 2019 21:38:41 +0000 (17:38 -0400)] 
Deprecate textual column matching in Row

Deprecate query.instances() without a context

Deprecate string alias with contains_eager()

Deprecated the behavior by which a :class:`.Column` can be used as the key
in a result set row lookup, when that :class:`.Column` is not part of the
SQL selectable that is being selected; that is, it is only matched on name.
A deprecation warning is now emitted for this case.   Various ORM use
cases, such as those involving :func:`.text` constructs, have been improved
so that this fallback logic is avoided in most cases.

Calling the :meth:`.Query.instances` method without passing a
:class:`.QueryContext` is deprecated.   The original use case for this was
that a :class:`.Query` could yield ORM objects when given only the entities
to be selected as well as a DBAPI cursor object.  However, for this to work
correctly there is essential metadata that is passed from a SQLAlchemy
:class:`.ResultProxy` that is derived from the mapped column expressions,
which comes originally from the :class:`.QueryContext`.   To retrieve ORM
results from arbitrary SELECT statements, the :meth:`.Query.from_statement`
method should be used.

Note there is a small bump in test_zoomark because the
column._label is being calculated for each of those columns within
baseline_3_properties, as it is now part of the result map.
This label can't be calculated when the column is attached
to the table because it needs to have all the columns present
to do this correctly.  Another approach here would be to
pre-load the _label before the test runs however the zoomark
tests don't have an easy place for this to happen and it's
not really worth it.

Fixes: #4877
Fixes: #4719
Change-Id: I9bd29e72e6dce7c855651d69ba68d7383469acbc

5 years agoWarn for object replaced in identity map during flush
Mike Bayer [Fri, 4 Oct 2019 15:12:27 +0000 (11:12 -0400)] 
Warn for object replaced in identity map during flush

A warning is emitted for a condition in which the :class:`.Session` may
implicitly swap an object out of the identity map for another one with the
same primary key, detaching the old one, which can be an observed result of
load operations which occur within the :meth:`.SessionEvents.after_flush`
hook.  The warning is intended to notify the user that some special
condition has caused this to happen and that the previous object may not be
in the expected state.

Fixes: #4890
Change-Id: Ide11c6b9f21ca67ff5a96266c521d0c56fd6af8d

5 years agoimport StringIO => import io 4889/head
Matt Kohl [Fri, 4 Oct 2019 05:56:50 +0000 (06:56 +0100)] 
import StringIO => import io

5 years agofix error in test_round_trip for TimeTest with mysql+pyodbc
Gord Thompson [Thu, 3 Oct 2019 22:18:54 +0000 (18:18 -0400)] 
fix error in test_round_trip for TimeTest with mysql+pyodbc

Fixes: #4879
### Description
create mysql+pyodbc-specific `_pyodbcTIME` class to avoid error thrown by `result_processor` in the (more) generic mysql/types.py.

### 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.

**Have a nice day!**

Closes: #4880
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4880
Pull-request-sha: 2e4c468c3ad685d6573e0d9755ba97a28df50b6c

Change-Id: Ib5c5b0971969c2a9870b7f43d06703618cfc56f7

5 years agoMerge "Change Oracle max_identifier_length to 128"
mike bayer [Thu, 3 Oct 2019 21:42:48 +0000 (21:42 +0000)] 
Merge "Change Oracle max_identifier_length to 128"

5 years agoMerge "call setinputsizes for cx_Oracle.DATETIME"
mike bayer [Thu, 3 Oct 2019 21:41:40 +0000 (21:41 +0000)] 
Merge "call setinputsizes for cx_Oracle.DATETIME"

5 years agoMerge "Apply quoting to SQL Server _switch_db"
mike bayer [Thu, 3 Oct 2019 21:40:27 +0000 (21:40 +0000)] 
Merge "Apply quoting to SQL Server _switch_db"

5 years agocall setinputsizes for cx_Oracle.DATETIME
Mike Bayer [Thu, 3 Oct 2019 18:09:54 +0000 (14:09 -0400)] 
call setinputsizes for cx_Oracle.DATETIME

Restored adding cx_Oracle.DATETIME to the setinputsizes() call when a
SQLAlchemy :class:`.Date`, :class:`.DateTime` or :class:`.Time` datatype is
used, so that in the case where a bound parameter is passed as NULL
in some complex queries (in particular this happens with some lazy load
situations), the type is still present.  This was removed
in the 1.2 series for arbitrary reasons.

Also adds a suite test for this generic situation.

What's not clear is that do we really need setinputsizes() for all
datatypes if we are supporting NULL in bound parameters.

Fixes: #4886
Change-Id: If99215c31861f9ea6f60a30d47f2f320adc4797f