Commit Graph

3418 Commits

Author SHA1 Message Date
Mike Bayer 55f930ef3d cherry-pick changelog update for 1.2.17 2019-01-11 10:15:39 -05:00
Mike Bayer b4a8c1fbcf cherry-pick changelog from 1.2.16 2019-01-11 10:15:38 -05:00
Mike Bayer 6f270fb0e3 happy new year
Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911
2019-01-11 10:06:10 -05:00
Mike Bayer 2db54ee92e Leave bytestring exception messages as bytestrings
Fixed a regression introduced in version 1.2 where a refactor
of the :class:`.SQLAlchemyError` base exception class introduced an
inappropriate coercion of a plain string message into Unicode under
python 2k, which is not handled by the Python interpreter for characters
outside of the platform's encoding (typically ascii).  The
:class:`.SQLAlchemyError` class now passes a bytestring through under
Py2K for ``__str__()`` as is the behavior of exception objects in general
under Py2K, does a safe coercion to unicode utf-8 with
backslash fallback for ``__unicode__()``.  For Py3K the message is
typically unicode already, but if not is again safe-coerced with utf-8
with backslash fallback for the ``__str__()`` method.

Fixes: #4429
Change-Id: I2289da3f2c45c7d0041fa43d838958f7614defc3
2019-01-10 18:02:00 -05:00
mike bayer f1706ae317 Merge "Skip expression-based index reflection for SQLite" 2019-01-10 02:07:24 +00:00
Mike Bayer 08994cb97c Skip expression-based index reflection for SQLite
Reflection of an index based on SQL expressions are now skipped with a
warning, in the same way as that of the Postgresql dialect, where we currently
do not support reflecting indexes that have SQL expressions within them.
Previously, an index with columns of None were produced which would break
tools like Alembic.

Fixes: #4431
Change-Id: I1363ade912d206b42669331e2be2bb6f444b65a2
2019-01-09 21:06:57 -05:00
Mike Bayer 2a840c147e Render correct DDL for unsetting table comments
Fixed issue where the DDL emitted for :class:`.DropTableComment`, which
will be used by an upcoming version of Alembic, was incorrect for the MySQL
and Oracle databases.

Fixes: #4436
Change-Id: I196de09495a37adface4caa9dcbc29a6d0ad159a
2019-01-09 11:18:02 -05:00
Charles S. Givre 86f243a874 Update index.rst - Added link to Drill dialect.
Added link to Apache Drill dialect.
2019-01-08 14:45:19 -05:00
Lele Gaifax c0f9708fde commit 1b774808c926665047bf353222ecd191679a95d1
Author: Lele Gaifax <lele@metapensiero.it>
Date:   Tue Dec 25 12:35:41 2018 +0100

    Consistently use "PostgreSQL", fixing also a few doc glitches

commit 0e382aaee4427193926f0dc10ad29056bc12c85e
Author: Lele Gaifax <lele@metapensiero.it>
Date:   Tue Dec 25 12:08:49 2018 +0100

    Remove duplicated words

Change-Id: Iaa586b9412f46a50fe6ff3bbb92e07d6cb1905c8
2018-12-30 21:16:52 -05:00
mike bayer cfc49b4571 Merge "Check collection less than two items remaining before firing scalar backref remove" 2018-12-29 07:59:58 +00:00
mike bayer 010dd34e7c Merge "Call __del() before remove()" 2018-12-29 07:58:21 +00:00
Mike Bayer 16f08cbed5 Add missing disambiguation to non-primary mapper example
The mapping to B over a join defines an alternate primary key
based on all the primary key columns in the join unless we
re-define it explicitly.   Similarly, people expect that
``.id`` looks the same.  make sure these line up with the
old mapping.

Change-Id: I1ab064c57019e79c34293f6588d1e033f7083974
2018-12-28 09:36:24 -05:00
Mike Bayer 847d135942 Check collection less than two items remaining before firing scalar backref remove
Fixed long-standing issue where duplicate collection members would cause a
backref to delete the association between the member and its parent object
when one of the duplicates were removed, as occurs as a side effect of
swapping two objects in one statement.

Fixes: #1103
Change-Id: Ic12877f7bd5a4eb688091725a78410748e7fdf16
2018-12-28 08:40:44 -05:00
Mike Bayer 07cea66ccb Call __del() before remove()
The "remove" event for collections is now called before the item is removed
in the case of the ``collection.remove()`` method, as is consistent with the
behavior for most other forms of collection item removal (such as
``__delitem__``, replacement under ``__setitem__``).  The ``pop()`` methods
are now the only exception as the target item is not available until after
the pop operation proceeds.

This allows ``remove()`` to be consistent in its behavior with all
the other collection operations, allows the "before_delete" hook
to be local to "pop()" operations only, and removes some method overhead.

We are also looking here to gain some more predictability in terms
of the fix for #1103.

Change-Id: I4fdea911517d65cc300fae0e9c351a471e52e4ab
2018-12-28 08:37:03 -05:00
Mike Bayer ec5c9ebe6e Implement SynonymProperty.get_history()
Implemented the ``.get_history()`` method, which also implies availability
of :attr:`.AttributeState.history`, for :func:`.synonym` attributes.
Previously, trying to access attribute history via a synonym would raise an
``AttributeError``.

Fixes: #3777
Change-Id: I20810a8b1a1bf630dbcb6622193c13cf4236b94a
2018-12-27 12:39:15 -05:00
Mike Bayer eae62d0004 - remove non-working dialects some of which are 404's
- put the five major dialect names on the front page
- remove old change messages

Change-Id: Ibf1dc2c499f10f98efb6c97d6c53e442e7746200
2018-12-24 00:07:22 -05:00
mike bayer d27023a30d Merge "Add before_mapper_configured event" 2018-12-23 15:44:37 +00:00
mike bayer 504432ed57 Merge "Maintain compiled_params / replacement_expressions within expanding IN" 2018-12-22 13:54:11 +00:00
Mike Bayer c495769751 Maintain compiled_params / replacement_expressions within expanding IN
Fixed issue in "expanding IN" feature where using the same bound parameter
name more than once in a query would lead to a KeyError within the process
of rewriting the parameters in the query.

Fixes: #4394
Change-Id: Ibcadce9fefbcb060266d9447c2044ee6efeccf5a
2018-12-21 21:50:55 -05:00
Mike Bayer 0b0a4c8ba2 Handle PostgreSQL enums in remote schemas
Fixed issue where a :class:`.postgresql.ENUM` or a custom domain present
in a remote schema would not be recognized within column reflection if
the name of the enum/domain or the name of the schema required quoting.
A new parsing scheme now fully parses out quoted or non-quoted tokens
including support for SQL-escaped quotes.

Fixed issue where multiple :class:`.postgresql.ENUM` objects referred to
by the same :class:`.MetaData` object would fail to be created if
multiple objects had the same name under different schema names.  The
internal memoization the Postgresql dialect uses to track if it has
created a particular :class:`.postgresql.ENUM` in the database during
a DDL creation sequence now takes schema name into account.

Fixes: #4416
Change-Id: I8cf03069e10b12f409e9b6796e24fc5850979955
2018-12-21 13:53:16 -05:00
Mike Bayer d4a130bb1b Document and support nested composites
Composites can behave in a "nested" fashion by defining the
class in that way.   To make the constructor more convenient,
a callable can be passed to :func:`.composite` instead of the
class itself.  This works now, so add a test to ensure this
pattern remains available.

Change-Id: Ia009f274fca7269f41d6d824e0f70b6fb0ada081
2018-12-12 12:54:20 -05:00
Mike Bayer 7206308e7f cherry-pick changelog update for 1.2.16 2018-12-11 16:56:37 -05:00
Mike Bayer 9e98a2c864 cherry-pick changelog from 1.2.15 2018-12-11 16:56:37 -05:00
Chris Wilson 65ea042302 Add before_mapper_configured event
This event is intended to allow a specific mapper to be skipped during the
configure step, by returning a value of `.orm.interfaces.EXT_SKIP` which means
the mapper will be skipped within this configure run. The "new mappers" flag
will remain set in this case and the configure operation will occur again.

This event, and its return value, make it possible to query one base while a
different one still needs configuration, which cannot be completed at this
time.

Fixes: #4397

Change-Id: I122e556f6a4ff842ad15315dcf39e19bb7f9a744
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4403
2018-12-10 22:31:21 -05:00
mike bayer 0d4c0c1a27 Merge "Refer to existing of_type when resolving string attribute name" 2018-12-08 14:19:28 +00:00
Mike Bayer d6f406e633 Take instance into account when determining AssociationProxyInstance
Fixed a regression in 1.3.0b1 caused by 🎫`3423` where association
proxy objects that access an attribute that's only present on a polymorphic
subclass would raise an ``AttributeError`` even though the actual instance
being accessed was an instance of that subclass.

Fixes: #4401
Change-Id: Ie62c48aa9142adff45cbf9a297184987c72f30f3
2018-12-07 22:40:50 -05:00
Mike Bayer 099f3fd812 Refer to existing of_type when resolving string attribute name
Fixed bug where chaining of mapper options using
:meth:`.RelationshipProperty.of_type` in conjunction with a chained option
that refers to an attribute name by string only would fail to locate the
attribute.

Fixes: #4400
Change-Id: I01bf449ec4d8f56bb8c34e25153c1c9b31ff8012
2018-12-07 16:03:17 -05:00
adriennefranke 09856b911b Fixed typo in docs
Fixes: #4166
Fixes: #4399
Change-Id: I49494209463089114e77dfc737c811837d49ea20
2018-12-05 20:31:31 -05:00
Mike Bayer 89f95e9bad All sphinx dependencies move under the github sqlalchemy organization
Change-Id: I7a0dc1ef320b6abad0eeac8b24c20f821e5b8c81
2018-12-03 17:02:23 -05:00
Jakub Synowiec 46f9c3c7d4 Fix PostgreSQL reflection of domains expressed as arrays
Fixed issue where reflection of a PostgreSQL domain that is expressed as an
array would fail to be recognized.  Pull request courtesy Jakub Synowiec.

Fixes: #4377
Change-Id: I252c79ca435b87d4d9172b1c84e0e74e789ef676
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4380
2018-12-01 13:30:42 -05:00
mike bayer c8dea359db Merge "Apply path generation for superclasses to Load._set_path_strategy()" 2018-12-01 16:52:22 +00:00
Mike Bayer fb05e085fe Apply path generation for superclasses to Load._set_path_strategy()
Extended the fix first made as part of 🎫`3287`, where a loader option
made against a subclass using a wildcard would extend itself to include
application of the wildcard to attributes on the super classes as well, to a
"bound" loader option as well, e.g. in an expression like
``Load(SomeSubClass).load_only('foo')``.  Columns that are part of the
parent class of ``SomeSubClass`` will also be excluded in the same way as if
the unbound option ``load_only('foo')`` were used.

Fixes: #4373
Change-Id: I2eee0e587c34323a77df077b9cb699da370c403d
2018-11-30 14:36:20 -05:00
mike bayer 7940e7dc9c Merge "Add __clause_element__ to ColumnProperty" 2018-11-30 18:12:02 +00:00
mike bayer f916fa3b31 Merge "Add the write_timeout option for mysql." 2018-11-30 18:11:06 +00:00
jun923.gu 6a8454ded3 Add the write_timeout option for mysql.
As MySQLdb support read_timeout and write_timeout option, and
sqlalchemy just support read_timeout option. So sqlalchemy need to add
write_timeout option.

Fixes: #4381
Change-Id: I2bea80bdd6f20fafc72b48fa0e5d795626d9d9b9
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4385
2018-11-30 00:22:58 -05:00
Mike Bayer 3ff3975767 Allow optional *args with base AnsiFunction
Amended the :class:`.AnsiFunction` class, the base of common SQL
functions like ``CURRENT_TIMESTAMP``, to accept positional arguments
like a regular ad-hoc function.  This to suit the case that many of
these functions on specific backends accept arguments such as
"fractional seconds" precision and such.  If the function is created
with arguments, it renders the the parenthesis and the arguments.  If
no arguents are present, the compiler generates the non-parenthesized form.

Fixes: #4386
Change-Id: Ic492ef177e4987cec99ec4d95f55292be8daa087
2018-11-29 23:46:42 -05:00
Mike Bayer 835444be72 Add __clause_element__ to ColumnProperty
Added a ``__clause_element__()`` method to :class:`.ColumnProperty` which
can allow the usage of a not-fully-declared column or deferred attribute in
a declarative mapped class slightly more friendly when it's used in a
constraint or other column-oriented scenario within the class declaration,
though this still can't work in open-ended expressions; prefer to call the
:attr:`.ColumnProperty.expression` attribute if receiving ``TypeError``.

Fixes: #4372
Change-Id: I5d3d1adb9c77de0566298bc2c46e9001d314b0c7
2018-11-27 20:12:16 -05:00
mike bayer ce3cab93d5 Merge "Warn for lower-case column attribute on declarative" 2018-11-27 07:54:43 +00:00
Mike Bayer 50417cf758 Move links etc. to github, new alembic links
Change-Id: I59392d355a216ae59552a04c5508f548b901aa7b
2018-11-26 22:58:50 -05:00
Mike Bayer 6ec40eca1a Warn for lower-case column attribute on declarative
A warning is emitted in the case that a :func:`.column` object is applied to
a declarative class, as it seems likely this intended to be a
:class:`.Column` object.

Fixes: #4374
Change-Id: I2e617ef65547162e3ba6587c168548ad0cf6203d
2018-11-26 01:12:01 -05:00
Mike Bayer b5cb68ac43 - remove @HEAD indicator from docs requirements, fixes #4375
Change-Id: I50b1622c2c2236bf9e436f61c7eea31faaeaa3e1
2018-11-25 23:54:44 -05:00
Mike Bayer f39a6216ee Version 1.3.0b2 placeholder 2018-11-16 23:13:08 -05:00
Mike Bayer 19590812c0 - 1.3.0b1 2018-11-16 23:04:42 -05:00
Mike Bayer b7fd3a3fc9 - edits
Change-Id: Ia8e1b5b51acc2b249499796ac36a7a3b68c941a1
2018-11-16 22:46:20 -05:00
Mike Bayer 9addf77342 - edits for 1.3 migration notes
Change-Id: Id2065053088481df5a703c63bfc88799a9943a5e
2018-11-16 18:52:42 -05:00
mike bayer d1f187ecfd Merge "Modernize cx_Oracle parameters" 2018-11-16 03:14:54 +00:00
Mike Bayer 60a8648776 - fix spacing
Change-Id: I460d873b4c6a250594e291b5f47fff5a06280817
2018-11-15 19:51:03 -05:00
Mike Bayer 477a64e2b2 Repair tutorial code example to be deterministic
A few queries featured an aggregate without a GROUP BY
or a complete ordering, causing the doctests to fail
with recent versions of SQLite.  The queries are now made
to include a GROUP BY as well as ORDER BY both columns.

Fixes: #4370
Change-Id: I904bddb4372224158fcecff9f0dbbbe7c1bf36b3
2018-11-15 19:48:45 -05:00
Mike Bayer e0e6fe44e3 Modernize cx_Oracle parameters
Updated the parameters that can be sent to the cx_Oracle DBAPI to both allow
for all current parameters as well as for future parameters not added yet.
In addition, removed unused parameters that were deprecated in version 1.2,
and additionally we are now defaulting "threaded" to False.

Fixes: #4369
Change-Id: I599668960e7b2d5bd1f5e6850e10b5b3ec215ed3
2018-11-15 12:56:37 -05:00
mike bayer 1f69e9b94c Merge "Add secondary selectable to FROM clauses for correlated exists" 2018-11-15 15:17:59 +00:00