Commit Graph

405 Commits

Author SHA1 Message Date
Mike Bayer 5d1a718214 - cross-link of_type() correctly
Change-Id: Iaacab5d2fe45b0b87fea922ec914e258dba9e30d
2017-11-02 13:40:43 -04:00
Mike Bayer 0236ab5694 Merge remote-tracking branch 'origin/pr/359' 2017-10-24 10:39:43 -04:00
Mike Bayer 1ec7ba52e1 - add more dragons to session.begin() / autocommit docs
Change-Id: I9e326f353d396321565dfbf53b7a30f18d8c86e9
2017-09-28 11:43:48 -04:00
mike bayer 3d50251e0a Merge "Document and test __table_cls__" 2017-09-27 15:38:29 -04:00
Mike Bayer 04bbad660b Document and test __table_cls__
A use case has been identified for __table_cls__, which was
added in 1.0 just for the purpose of test fixtures.   Add this to
public API and ensure the target use case (conditional table generation)
stays supported.

Change-Id: I87be5bcb72205cab89871fa586663bf147450995
Fixes: #4082
2017-09-26 11:38:18 -04:00
Mike Bayer ec1700ba29 Warnings for @declared_attr.cascading
A warning is emitted if a subclass attempts to override an attribute
that was declared on a superclass using ``@declared_attr.cascading``
that the overridden attribute will be ignored. This use
case cannot be fully supported down to further subclasses without more
complex development efforts, so for consistency the "cascading" is
honored all the way down regardless of overriding attributes.

A warning is emitted if the ``@declared_attr.cascading`` attribute is
used with a special declarative name such as ``__tablename__``, as this
has no effect.

Ensure that documenation refers to the current inconsistency that
__tablename__ can be overridden by subclasses however
@declared_attr.cascading cannot.

Fixes: #4091
Fixes: #4092
Change-Id: I3aecdb2f99d408e404a1223f5ad86ae3c7fdf036
2017-09-26 11:36:08 -04:00
Mike Bayer eaceeae0f7 Merge branch 'master--typos' of https://github.com/nphilipp/sqlalchemy 2017-08-09 09:32:51 -04:00
Mike Bayer 68879d50fa Enable multi-level selectin polymorphic loading
Change-Id: Icc742bbeecdb7448ce84caccd63e086af16e81c1
Fixes: #4026
2017-08-07 15:05:00 -04:00
Mike Bayer 4b4f8fbf25 - modernize orm.reconstructor documentation a bit
Change-Id: Ied786e8f9ad78f524be03a382d002dada7dd218b
2017-08-05 21:46:24 -04:00
Nils Philippsen 7765724d51 fix "constrast" typos 2017-08-05 13:31:06 +02:00
Feanil Patel c9b37f9689 Make flush logic slightly clearer in tutorial.
Improve the wording of how sessions commit changes.
2017-07-23 09:17:39 -04:00
Mike Bayer 32f67637cd Merge branch 'patch-1' of https://github.com/tomsitter/sqlalchemy 2017-07-17 10:31:07 -04:00
Tom Sitter 43f41fbfaa Replace Session class with session instance
The Session class was used instead of the session instance which resulted in an attribute error.
2017-07-12 11:54:25 -04:00
Pablo Marti c6b4675982 Fix typo, foriegn -> foreign 2017-07-10 19:43:58 +02:00
Mike Bayer 14253e7ff4 - fix exposed "sourcecode" tags
Change-Id: Ie1bdcf2773f3de96d5ca26ebf80657e5d72c70f9
2017-07-09 13:13:25 -04:00
Mike Bayer 9ac0f8119e Support state expiration for with_expression(); rename deferred_expression
The attributeimpl for a deferred_expression does not
support a scalar loader, add new configurability so that
the impl can have this flag turned off.   Document
that the with_expression() system currently does not
offer any deferred loading.

To eliminate confusion over "deferred", which refers to
lazy loading of column attributes, and "with_expression",
which refers to an attribute that is explicitly at
query time only, rename deferred_expression to query_expression.

Change-Id: I07c4a050ed68c79ccbde9492e9de1630b7470d74
2017-06-26 13:49:49 -04:00
Mike Bayer 83c1e03c5c Add ad-hoc mapped expressions
Added a new feature :func:`.orm.with_expression` that allows an ad-hoc
SQL expression to be added to a specific entity in a query at result
time.  This is an alternative to the SQL expression being delivered as
a separate element in the result tuple.

Change-Id: Id8c479f7489fb02e09427837c59d1eabb2a6c014
Fixes: #3058
2017-06-19 17:41:39 -04:00
Mike Bayer bb6a1f690d selectin polymorphic loading
Added a new style of mapper-level inheritance loading
"polymorphic selectin".  This style of loading
emits queries for each subclass in an inheritance
hierarchy subsequent to the load of the base
object type, using IN to specify the desired
primary key values.

Fixes: #3948

Change-Id: I59e071c6142354a3f95730046e3dcdfc0e2c4de5
2017-06-05 11:27:00 -04:00
Mike Bayer 7fc7492d86 - add session.close() w/ rationale to top-level "using transactions"
section.  References #3974

Change-Id: Idb650cbe9825cfae893ee917132b5b9d693f0c6c
2017-05-23 11:35:12 -04:00
Kataev Denis 42b6ef8ccd Repair formatting throughout documentation
1. Section decorators to [one style](http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections):
without inset at both side and with same length as text.
2. Fix broken [reference](http://docs.sqlalchemy.org/en/latest/core/type_basics.html#generic-types).
3. Convert tabs to space in some small files.
4. Some python code snippets have python+sql syntax hint.

Change-Id: I39a7a41ef0b0591c6bf1e610748e2b5c19fc5379
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/361
2017-05-22 17:53:09 -04:00
Mike Bayer da1bc9878b - add a note to versioning that version id col cannot be null,
is not supported.

Change-Id: I3724fea3f2d508210e35827eb1ea17f5e334da19
Fixes: #3673
(cherry picked from commit fcaf17766fdd22e67407e432f7666d63439d7a39)
(cherry picked from commit 8cce3beef7)
2017-05-22 14:33:30 -04:00
Mike Bayer 912fb6c2d5 Add new configuration, inspection for baked queries
Added new flag :paramref:`.Session.enable_baked_queries` to the
:class:`.Session` to allow baked queries to be disabled
session-wide, reducing memory use.   Also added new :class:`.Bakery`
wrapper so that the bakery returned by :paramref:`.BakedQuery.bakery`
can be inspected.

Change-Id: I5657af7a99d2b24c89d6aee1343f432728e3f807
2017-05-17 17:08:23 -04:00
Mike Bayer 4c6917e1d6 - add complete parameter /return value docs to session.begin() /
session.begin_nested().  Fixes #3993

Change-Id: If485d77b364c34d94061d2f48efbde3f8a8adec9
2017-05-17 10:58:37 -04:00
Mike Bayer 75c8b88cdd - move additional sections under with_polymorphic missed
in the previous change

Change-Id: I20217d4d4ebfc033229d87e472ad82d32202617a
2017-05-16 11:00:41 -04:00
Mike Bayer 6079158b21 - categorize these two with_polymorphic subsections under with_polymorphic
Change-Id: I8bd49ac241df4b8645c8f78938d6f8122952d75a
2017-05-16 10:51:14 -04:00
Mike Bayer 5329fc481e modernize and repair inheritance examples
remarkably, the examples for concrete and single were still
using classical mappings.    Ensure all three examples use
modern declarative patterns, each illustrate the identical set
of query operations.  Use back_populates, flat=True for joins,
etc. ensure flake8 linting, correct links and add a link back
from newly reworked inheritance documentation.

Change-Id: I8465a9badbb0eda804f457ccac599f051ee3c27c
2017-05-16 09:51:06 -04:00
Mike Bayer 6194483b73 Update inheritance documentation.
The inheritance documentation is confused, disorganized, and out
of date.  Reorganize and clarify, in particular in preparation
for new inheritance features.

Change-Id: Ibe6a35b4b0432bad866a6afb0598b2cf1b509f10
2017-05-10 20:21:40 -04:00
wodim 3380390b7a fix typo 2017-05-05 22:40:16 +02:00
Mike Bayer 19d2424e05 Add selectin loading
Adding a new kind of relationship loader that is
a cross between the "immediateload" and the "subquery"
eager loader, using an IN criteria to load related items
in bulk immediately after the lead query result is loaded.

Change-Id: If13713fba9b465865aef8fd50b5b6b977fe3ef7d
Fixes: #3944
2017-04-26 16:08:57 -04:00
Mike Bayer 6560bf82f3 - edits
Change-Id: If2445c4cbcd7eb18e06823e8821940a391890979
2017-04-22 16:43:31 -04:00
Mike Bayer e53009e253 - update relationship loader docs, backport from
1.2 wip

Change-Id: I0a3c4a0166f6feed23a021723233d281fad597ec
2017-04-21 18:12:56 -04:00
Mike Bayer c2834f9298 - remove errant doctest comment
Change-Id: Idb8520ff807074ceca36645728a63b79d1cdff6c
2017-04-17 15:33:12 -04:00
Mike Bayer b7644319e8 Use baked lazyloading by default
The ``lazy="select"`` loader strategy now makes used of the
:class:`.BakedQuery` query caching system in all cases.  This
removes most overhead of generating a :class:`.Query` object and
running it into a :func:`.select` and then string SQL statement from
the process of lazy-loading related collections and objects.  The
"baked" lazy loader has also been improved such that it can now
cache in most cases where query load options are used.

Change-Id: Ic96792fffaa045ae9aa0a4657d6d29235d3efb85
Fixes: #3954
2017-04-13 14:22:59 -04:00
Bertrand Janin 6524838950 Fix typo. 2017-04-04 09:11:25 -04:00
Mike Bayer ecf85cb083 Merge branch 'patch-1' of https://github.com/tamentis/sqlalchemy 2017-03-27 11:30:37 -04:00
Mike Bayer 1fcbc17b7d Support hybrids/composites with bulk updates
The :meth:`.Query.update` method can now accommodate both
hybrid attributes as well as composite attributes as a source
of the key to be placed in the SET clause.   For hybrids, an
additional decorator :meth:`.hybrid_property.update_expression`
is supplied for which the user supplies a tuple-returning function.

Change-Id: I15e97b02381d553f30b3301308155e19128d2cfb
Fixes: #3229
2017-03-22 17:44:56 -04:00
Mike Bayer 711d29f8e4 Raise on flag_modified() for non-present attribute
The :func:`.attributes.flag_modified` function now raises
:class:`.InvalidRequestError` if the named attribute key is not
present within the object, as this is assumed to be present
in the flush process.  To mark an object "dirty" for a flush
without referring to any specific attribute, the
:func:`.attributes.flag_dirty` function may be used.

Change-Id: I6c64e4d253c239e38632f38c27bb16e68fe8dfbe
Fixes: #3753
2017-03-21 17:35:12 -04:00
Bertrand Janin 5df05d1670 Fix a title typo
Utilites -> Utilities
2017-03-19 18:05:54 -04:00
Mike Bayer 1da9d37521 - bump minimum python version to 2.7
- add placeholder 1.2 release documentation, update intro numbers

Change-Id: I9f9969cbb9e95c2f750a5c16798e92c35a5ef6cf
2017-03-10 14:28:49 -05:00
Mike Bayer 46828cc157 - correctly document LIKE / ILIKE, fixes #3890
Change-Id: Ie59e61f53d7c59a4777ab9e6e75a43c71d67523b
2017-01-16 16:27:48 -05:00
Francisco Capdevila 8f191ec3b8 Typo 2016-12-22 15:08:23 -03:00
Mike Bayer a1de76c42f - xmin example requires a server default declaration to function
correctly

Change-Id: I1cc50da6fe1c0eeef1d00201b45d998daddfd8ac
2016-12-12 12:07:11 -05:00
jfinkels d0d4e391c5 Adds missing word "of" in docs 2016-10-30 22:22:54 -04:00
Randy Barlow 055b207a9f Fix a minor grammatical error in the ORM tutorial.
Change-Id: I50daaee2645dd8aa2ee7217f4065589492ed0b7d
2016-10-13 13:02:26 -04:00
Ville Skyttä 8c2c464cb8 spelling: Postgresql -> PostgreSQL 2016-10-08 20:42:50 +03:00
Mike Bayer cbe99b0667 - add a note to baked documentation indicating it is not
really of general use.  This extension is there only
for those who really want it based on observed performance
characteristics.

Change-Id: I2f612f26fdef4ddbeb1158ab1b344fad7083b11c
2016-10-04 12:01:12 -04:00
Mike Bayer 9bfd028938 - some documentation hits
Change-Id: I468fe70168804b08cf0d5e8b57e235bca904b1ff
2016-10-01 09:42:21 -04:00
Dmitry Bogun dce3206223 Remove extra "return" statement in orm.ext.declared_attr.cascading examples
Also improves some naming in the examples.

Change-Id: I51e5b1d9a730885aed10e5e6ade2123f5e736359
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/306
2016-10-01 09:27:47 -04:00
Edouard Berthe 53c3119ebb Corrects typo
This example doesn't work with 'back_populates' because 'parent_associations' and 'child_associations' are not defined in Parent and Child classes respectively.
Alternatively, we could create 'parent_associations' and 'child_associations' into the classes.
2016-08-31 16:52:48 +10:00
Mike Bayer 5b86ae5e8a Merge remote-tracking branch 'origin/pr/299' 2016-08-16 12:04:41 -04:00