Commit Graph

7009 Commits

Author SHA1 Message Date
Mike Bayer e45e4aa97d Merge remote-tracking branch 'origin/pr/210' 2015-11-30 11:40:44 -05:00
Mike Bayer b0308a7b3a - Fixed an issue in baked queries where the .get() method, used either
directly or within lazy loads, didn't consider the mapper's "get clause"
as part of the cache key, causing bound parameter mismatches if the
clause got re-generated.  This clause is cached by mappers
on the fly but in highly concurrent scenarios may be generated more
than once when first accessed.
fixes #3597
2015-11-29 11:42:55 -05:00
Mike Bayer c90f0a49f3 - Added support for parameter-ordered SET clauses in an UPDATE
statement.  This feature is available by passing the
:paramref:`~.sqlalchemy.sql.expression.update.preserve_parameter_order`
flag either to the core :class:`.Update` construct or alternatively
adding it to the :paramref:`.Query.update.update_args` dictionary at
the ORM-level, also passing the parameters themselves as a list of 2-tuples.
Thanks to Gorka Eguileor for implementation and tests.
adapted from pullreq github:200
2015-11-28 14:30:05 -05:00
Mike Bayer 1202e140b9 - Fixed bug which is actually a regression that occurred between
versions 0.8.0 and 0.8.1, due 🎫`2714`.  The case where
joined eager loading needs to join out over a subclass-bound
relationship when "with_polymorphic" were also used would fail
to join from the correct entity.
fixes #3593
2015-11-25 15:29:04 -05:00
Mike Bayer 2a2be6a2ce - support declarativemappedtest with per-test setup 2015-11-25 15:15:35 -05:00
Bas van den Heuvel 054b22c786 - Change "expr" to "entity" for example illustrating an event
that intercepts a query and adds entity-oriented criteria
2015-11-24 14:10:51 -05:00
Mike Bayer 60c36ca841 - Fixed joinedload bug which would occur when a. the query includes
limit/offset criteria that forces a subquery b. the relationship
uses "secondary" c. the primaryjoin of the relationship refers to
a column that is either not part of the primary key, or is a PK
col in a joined-inheritance subclass table that is under a different
attribute name than the parent table's primary key column d. the
query defers the columns that are present in the primaryjoin, typically
via not being included in load_only(); the necessary column(s) would
not be present in the subquery and produce invalid SQL.
fixes #3592
2015-11-21 16:36:50 -05:00
Mike Bayer a6fe4dc0c8 - A rare case which occurs when a :meth:.Session.rollback fails in the
scope of a :meth:`.Session.flush` operation that's raising an
exception, as has been observed in some MySQL SAVEPOINT cases, prevents
the original  database exception from being observed when it was
emitted during  flush, but only on Py2K because Py2K does not support
exception  chaining; on Py3K the originating exception is chained.  As
a workaround, a warning is emitted in this specific case showing at
least the string message of the original database error before we
proceed to raise  the rollback-originating exception.
fixes #2696
2015-11-19 15:45:17 -05:00
Mike Bayer 9ed36c2eed - Fixed the `.python_type attribute of :class:.postgresql.INTERVAL`
to return ``datetime.timedelta`` in the same way as that of
:obj:`.types.Interval.python_type`, rather than raising
``NotImplementedError``.
fixes #3571

(cherry picked from commit 29d6f6e19b)
2015-11-19 15:11:37 -05:00
Mike Bayer c7f9aa2818 - rewrite the docs and add a test for the bake_queries=True
relationship flag; this flag *does* have an effect when the baked
lazy loader plugin has been invoked.  clarify the intent of this
flag as an "opt out" but only has an effect when the baked system
is loaded anyway.  fixes #3572
2015-11-19 14:23:08 -05:00
Mike Bayer 14498364f8 - Added support for reflecting the source of materialized views
to the Postgresql version of the :meth:`.Inspector.get_view_definition`
method.
fixes #3587
2015-11-18 09:06:33 -05:00
Mike Bayer 0847097c29 - extend pullreq github:213 to also include DATETIMEOFFSET and TIME,
which also accept zero precision
- extend test case here to include a backend-agnostic suite
- changelog for MSSQL date fix
2015-11-14 12:38:45 -05:00
Mike Bayer ac9ded338f Merge remote-tracking branch 'origin/pr/213' into pr213 2015-11-14 11:39:58 -05:00
Jacobo de Vera 80ce23f6fd Pass precision value to mssql.DATETIME2 when it is 0
The simple check on the precision results in DATETIME2(0) generating a
DATETIME2 column, with default precision, which is 7.
2015-11-13 20:51:05 +01:00
Mike Bayer 37565d2ce2 - fix missing argument in TypeDecorator.copy(), fixes #3584, references #2919 2015-11-13 11:01:49 -05:00
Mike Bayer 3370cbde50 - correct the commit from ref #3582 to refer to the correct sub-element 2015-11-11 14:21:02 -05:00
Mike Bayer 33c378f768 - Fixed bug where the "single table inheritance" criteria would be
added onto the end of a query in some inappropriate situations, such
as when querying from an exists() of a single-inheritance subclass.

fixes #3582
2015-11-11 12:57:32 -05:00
Mike Bayer d51a36397e Merge branch 'jeffwidman/update-links-in-sqlalchemy-docs-that-poi-1446667164356' of https://bitbucket.org/jeffwidman/sqlalchemy 2015-11-10 13:00:03 -05:00
Sven Schliesing 887edc431a fix typo: Explcitly -> Explicitly 2015-11-10 08:25:27 +01:00
Jeff Widman a2e83dbd2a Updated PostgreSQL links to point to "current" rather than hardcoded version 2015-11-05 23:34:27 +00:00
Jeff Widman 0d3ab3198a Update links in SQLAlchemy docs that point to postgres docs to use 'devel' rather than hardcoded version 2015-11-04 19:59:28 +00:00
Mike Bayer 07a199d929 - cross-linking for pool recycle feature 2015-10-30 11:47:32 -04:00
Mike Bayer 382950b701 Merge branch 'pr204' 2015-10-29 14:38:34 -04:00
Mike Bayer e31211c578 - convert wrap_callable() to a general purpose update_wrapper-like
function; the caller still passes in the "wrapper"
- move tests for wrap_callable() to be generic util tests
- changelog for pullreq github:204
2015-10-29 14:28:00 -04:00
Jacob MacDonald e8a5ed9c1c Update usages of getargspec to compat version.
The places inspect.getargspec was being used were causing problems for
newer Python versions.
2015-10-29 12:09:15 -06:00
Mike Bayer 98c1dcc6bc - add a JSON warning for coerce_compared_value 2015-10-28 11:22:55 -04:00
Mike Bayer 2daaacef04 - update the pool pessimistic invalidation recipe to refer to the
engine_connect event, allowing easy detection of disconnects
and full invalidation of the pool
2015-10-22 11:58:25 -04:00
Mike Bayer 13278d1108 - try to make this language more succinct and fix links
(cherry picked from commit 3ffe8569fb)
2015-10-20 18:13:16 -04:00
Mike Bayer 8e9a81a19e - adjust 4f54607923 where we still allow_multirow as long
as versioning isn't needed, fixes test_unitofworkv2->test_update_multi_missing_broken_multi_rowcount
2015-10-19 14:22:31 -04:00
Mike Bayer 1e0afd584c - Fixed regression in 1.0 where new feature of using "executemany"
for UPDATE statements in the ORM (e.g. :ref:`feature_updatemany`)
would break on Postgresql and other RETURNING backends
when using server-side version generation
schemes, as the server side value is retrieved via RETURNING which
is not supported with executemany.
fixes #3556
2015-10-19 12:17:37 -04:00
Martin J. Hsu c7d04beeac - wrap ColumnDefault empty arg callables like functools.wraps, setting __name__, __doc__, and __module__ 2015-10-15 10:46:33 +08:00
Mike Bayer 9d08c6abc2 - Added the :paramref:.AssociationProxy.info parameter to the
:class:`.AssociationProxy` constructor, to suit the
:attr:`.AssociationProxy.info` accessor that was added in
🎫`2971`.  This is possible because :class:`.AssociationProxy`
is constructed explicitly, unlike a hybrid which is constructed
implicitly via the decorator syntax.
fixes #3551
2015-10-09 18:01:43 -04:00
Mike Bayer 78a7bbdb3b Merge remote-tracking branch 'origin/pr/203' 2015-10-09 17:11:56 -04:00
Mike Bayer 2ef7c5e499 Merge remote-tracking branch 'origin/pr/205' 2015-10-09 17:07:52 -04:00
Mike Bayer 845500280d - open up autoincrement for columns that have a default; autoinc is usually
"auto" now so True can indicate the dialect would support this
2015-10-08 17:02:55 -04:00
Mike Bayer 956c26d077 Merge remote-tracking branch 'origin/pr/208' 2015-10-08 00:33:02 -04:00
Mike Bayer 21b5d353ce - for DB's w/o a real "autoincrement", reflection should be returning
"auto", doesn't matter if there's a default here
2015-10-07 23:41:24 -04:00
Peter Demin f8eb7c2858 Update base.py
Docstring typo keysowrds => keywords
2015-10-07 11:38:48 -04:00
Mike Bayer 414af7b612 - The system by which a :class:.Column considers itself to be an
"auto increment" column has been changed, such that autoincrement
is no longer implicitly enabled for a :class:`.Table` that has a
composite primary key.  In order to accommodate being able to enable
autoincrement for a composite PK member column while at the same time
maintaining SQLAlchemy's long standing behavior of enabling
implicit autoincrement for a single integer primary key, a third
state has been added to the :paramref:`.Column.autoincrement` parameter
``"auto"``, which is now the default. fixes #3216
- The MySQL dialect no longer generates an extra "KEY" directive when
generating CREATE TABLE DDL for a table using InnoDB with a
composite primary key with AUTO_INCREMENT on a column that isn't the
first column;  to overcome InnoDB's limitation here, the PRIMARY KEY
constraint is now generated with the AUTO_INCREMENT column placed
first in the list of columns.
2015-10-07 10:02:45 -04:00
Mike Bayer 4578ab54a5 - Fixed bug in Oracle dialect where reflection of tables and other
symbols with names quoted to force all-lower-case would not be
identified properly in reflection queries.  The :class:`.quoted_name`
construct is now applied to incoming symbol names that detect as
forced into all-lower-case within the "name normalize" process.
fixes #3548
2015-10-05 09:49:34 -04:00
Mike Bayer ac08920284 - remove ambiguous use of the phrase "joined together by AND" as this
may be construed as the Python "and" keyword
- add notes to ORM tutorial for beginners that Python "and" keyword
is not to be used
fixes #3545
2015-10-01 09:38:22 -04:00
Mike Bayer 7393ee8d4f - bzzt, fix the base _post_configure_engine() call to not fail 2015-09-29 11:33:45 -04:00
Mike Bayer 5bb2536cc5 - limit the search for schemas to not include "temp", which is sort of an implicit schema
- repair the CREATE INDEX ddl for schemas
- update provisioning to include support for setting up ATTACH DATABASE up front
for the test_schema; enable "schemas" testing for SQLite
- changelog / migration notes for new SQLite schema support
- include the "schema" as the "remote_schema" when we reflect SQLite FKs
2015-09-28 17:48:55 -04:00
Mike Bayer e4d445c6f5 Merge remote-tracking branch 'origin/pr/198' into pr198 2015-09-28 15:40:39 -04:00
Eric Siegerman febe0c0faa Doc fix 2015-09-28 12:12:27 -04:00
Eric Siegerman 2e5e6ff96c Remplement Query.one() in terms of .one_or_none()
Thanks to Mike Bayer for suggesting a simpler refactoring.
2015-09-28 12:08:19 -04:00
Eric Siegerman 91255618dd Fix sqlalchemy.ext.baked.Result.one_or_none() exception message
Also add a couple of missing tests.
2015-09-24 15:25:15 -04:00
Mike Bayer 5b71858533 - replicate Query.one_or_none to BakedQuery
- changelog / version note finishing
2015-09-24 13:52:25 -04:00
Eric Siegerman a9b5fb3f49 Add Query.one_or_none() 2015-09-24 13:22:45 -04:00
Eric Siegerman 0854f82993 Add a lot more detail
(cherry picked from commit 5db5e18d3b)
2015-09-23 17:05:20 -04:00