summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Enable F841Mike Bayer2019-06-205-16/+11
| | | | | | | | | | | This is a very useful assertion which prevents unused variables from being set up allows code to be more readable and sometimes even more efficient. test suites seem to be where the most problems are and there do not seem to be documentation examples that are using this, or at least the linter is not taking effect within rst blocks. Change-Id: I2b3341d8dd14da34879d8425838e66a4b9f8e27d
* Use py.test for versioned_history tests, nose no longer runsMike Bayer2019-05-251-3/+6
| | | | | | | without warnings under python 3 Fixes: #4697 Change-Id: I46d395d3b6642acd9317e27d6a5723ae5201e877
* Resolve RST306 issuesMike Bayer2019-05-131-1/+1
| | | | | | | | The latest flake8 seems to look for these and they are in fact correctable with a backslash. Also need to add r to the strings to avoid W605. Change-Id: I8045309aa2ad29978ba7e99c45f75bc1457dff3d
* Fix large_resultsets performance example field nameMatt Schuchhardt2019-03-061-2/+2
| | | | | | | | | | | | | Fixed bug in large_resultsets example case where a re-named "id" variable due to code reformatting caused the test to fail. Pull request courtesy Matt Schuchhardt. Fixes: #4528 Closes: #4529 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4529 Pull-request-sha: 8f52f10422114c397254db9e6f940d042708e0bd Change-Id: Iaca6fd06ec0ede8ff1745d627708ba492a2114c8
* Reinstate elementtree exampleVraj Mohan2019-01-164-25/+16
| | | | | | | | | | Partially fixes sqlalchemy/sqlalchemy#4426. Closes: #4441 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4441 Pull-request-sha: ed90f3b77c2d0f4cc2cd54f40f5af29b489977d2 Change-Id: Ic32e5d8020073da055b12a6aeb61e698a97dc504
* Post black reformattingMike Bayer2019-01-0652-423/+593
| | | | | | | | | | | | | Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
* Run black -l 79 against all source filesMike Bayer2019-01-0662-1742/+2435
| | | | | | | | | | | | | | This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
* Add versioned_update_old_row exampleMike Bayer2018-12-071-0/+279
| | | | | | | | A modification to the "turn UPDATE into INSERT" recipe that also UPDATEs the previous row. The example is using timestamps to maintain a relationship between two objects. Change-Id: Ifdb8ee73616190384263bbe88c71d9278d616f6b
* - fix formatting on examples to list the description first, some flake8Mike Bayer2018-12-0716-126/+107
| | | | Change-Id: I57144a559f20abab02e745d052be5ff84edec7f8
* Clarify init_scalar event use caseMike Bayer2018-09-061-0/+5
| | | | | | | | Since I didn't even realize what this was for when reading the docs, make it clearer that this is to mirror a Column default and remove the extra verbiage about the mechanics of INSERTs. Change-Id: Id2c6a29800f7b723573610e4707aec7e6ea38f5f
* Add Query.lazy_load_from attribute for shardingMike Bayer2018-06-041-1/+7
| | | | | | | | | | | | | | | | | | Added new attribute :attr:`.Query.lazy_loaded_from` which is populated with an :class:`.InstanceState` that is using this :class:`.Query` in order to lazy load a relationship. The rationale for this is that it serves as a hint for the horizontal sharding feature to use, such that the identity token of the state can be used as the default identity token to use for the query within id_chooser(). Also repaired an issue in the :meth:`.Result.with_post_criteria` method added in I899808734458e25a023142c2c5bb37cbed869479 for :ticket:`4128` where the "unbake subquery loaders" version was calling the post crtieria functions given the :class:`.Result` as the argument rather than applying them to the :class:`.Query`. Change-Id: I3c0919ce7fd151b80fe2f9b5f99f60df31c2d73d Fixes: #4243
* Update dogpile.cache example to be compatible with baked query.Mike Bayer2018-05-171-2/+41
| | | | | | | | | | | | | | | | Updated the dogpile.caching example to include new structures that accommodate for the "baked" query system, which is used by default within lazy loaders and some eager relationship loaders. The dogpile.caching "relationship_caching" and "advanced" examples were also broken due to :ticket:`4256`. The issue here is also worked-around by the fix in :ticket:`4128`. Note that this recipe requires I3f86fcb12a6a9a89aa308b335e75c25969bcc30e in order for the "advanced" example to work. Change-Id: I9d35417f1d6c1906555583b8225d3da7f81736f7 Fixes: #4258
* - modernize versioning examplesMike Bayer2018-05-055-72/+246
| | | | | | - add new example versioned_rows_w_versionid Change-Id: I592cd5eb7db50162b4c4ad6191813d9def2b6d7c
* - add space invaders exampleMike Bayer2018-04-272-0/+778
| | | | Change-Id: I439b6012af8c2bd8f555744657b8091ac168242b
* Add an identity_token to the identity keyMike Bayer2017-12-221-99/+106
| | | | | | | | | For the purposes of assisting with sharded setups, add a new member to the identity key that can be customized. this allows sharding across databases where the primary key space is shared. Change-Id: Iae3909f5d4c501b62c10d0371fbceb01abda51db Fixes: #4137
* modernize and repair inheritance examplesMike Bayer2017-05-164-173/+334
| | | | | | | | | | | 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
* fix pep8 errors in association examplePaul Brown2017-03-184-20/+33
| | | | (cherry picked from commit 6aad7fb4217ef294f68f693be5b3137c28184949)
* fix pep8 errors in adjacency_list examplePaul Brown2017-03-182-30/+30
| | | | (cherry picked from commit ff230f1862892eb2b479ed85e6858a82159b435f)
* Set autoincrement to False; use sqlite_autoincrement in versioned_historyCarlos García Montoro2017-01-092-1/+50
| | | | | | | | | | | | Ensure that the history table sets autoincrement=False, since these values are copied in all cases; the flag will emit an error as of 1.1 if the primary key is composite. Additionally, use the sqlite_autoincrement flag so that SQLite uses unique primary key identifiers for new rows even if some rows have been deleted. Fixes: #3872 Change-Id: I65912eb394b3b69d7f4e3c098f4f948b0a7a5374 Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/93
* spelling: Postgis -> PostGISVille Skyttä2016-10-081-2/+2
|
* Add an init_scalar event for attributesMike Bayer2016-06-022-1/+109
| | | | | | | | | This allows us to build default-setting recipes such as one that allows us to actively read column-level defaults. An example suite is also added. Change-Id: I7b022d52cc89526132d5bc4201ac27fea4cf088d Fixes: #1311
* Convert readthedocs link for their .org -> .io migration for hosted projectspr/278Adam Chainz2016-05-291-1/+1
| | | | | | | | As per their email ‘Changes to project subdomains’: > Starting today, Read the Docs will start hosting projects from subdomains on the domain readthedocs.io, instead of on readthedocs.org. This change addresses some security concerns around site cookies while hosting user generated data on the same domain as our dashboard. Test Plan: Manually visited all the links I’ve modified.
* Repair dictlike-polymorphicMike Bayer2016-05-241-1/+1
| | | | | | | | | | dictlike-polymorphic was broken by the change in 1714e0d6ef28411e9c6633018564af1cae58c3d9. Use the new style of inheritance. Fixes: #3704 Change-Id: I3509ef4bf7772dd6994daf600accf4a2c5eb6973
* Simplify directed graph exampleMike Bayer2016-04-261-47/+43
| | | | | | | | | | Changed the "directed graph" example to no longer consider integer identifiers of nodes as significant; the "higher" / "lower" references now allow mutual edges in both directions. Change-Id: Ibfd5b420f0451a6fc746f0bcbbbb062f8f88dc1d Fixes: #3698 (cherry picked from commit c3de4061fd490adcd8b75c79685f4a831b869f9e)
* Docstring Fixpr/254Patrick2016-03-301-2/+2
| | | | Change the docstring in short_selects example to match the code
* - Fixed two issues in the "history_meta" example where history trackingMike Bayer2015-08-242-4/+69
| | | | | | could encounter empty history, and where a column keyed to an alternate attribute name would fail to track properly. Fixes courtesy Alex Fraser.
* - Added a new extension suite :mod:`sqlalchemy.ext.baked`. ThisMike Bayer2015-03-112-1/+26
| | | | | | | | simple but unusual system allows for a dramatic savings in Python overhead for the construction and processing of orm :class:`.Query` objects, from query construction up through rendering of a string SQL statement. fixes #3054
* - add a callers optionMike Bayer2015-03-091-1/+7
|
* - pick around gaining modest dings in callcounts here and thereMike Bayer2015-03-091-1/+1
|
* - random performance whacking vs. 0.9, in particular we have to watchMike Bayer2015-03-083-10/+12
| | | | for the slots-based __getattr__ thing getting hit
* - add this for testingMike Bayer2015-03-081-0/+109
|
* Maul the evaulate & friends typoPriit Laes2014-12-191-1/+1
|
* - A new series of :class:`.Session` methods which provide hooksMike Bayer2014-12-082-0/+11
| | | | | | | | | | directly into the unit of work's facility for emitting INSERT and UPDATE statements has been created. When used correctly, this expert-oriented system can allow ORM-mappings to be used to generate bulk insert and update statements batched into executemany groups, allowing the statements to proceed at speeds that rival direct use of the Core. fixes #3100
* Merge branch 'master' into ticket_3100Mike Bayer2014-12-073-74/+204
|\
| * - Updated the :ref:`examples_versioned_history` example such thatMike Bayer2014-11-262-21/+97
| | | | | | | | | | | | | | | | | | | | mapped columns are re-mapped to match column names as well as grouping of columns; in particular, this allows columns that are explicitly grouped in a same-column-named joined inheritance scenario to be mapped in the same way in the history mappings, avoiding warnings added in the 0.9 series regarding this pattern and allowing the same view of attribute keys.
| * - formattingMike Bayer2014-11-262-53/+106
| |
| * - Fixed a bug in the ↵Mike Bayer2014-11-241-0/+1
| | | | | | | | | | | | | | | | examples/generic_assocaitions/discriminator_on_association.py example, where the subclasses of AddressAssociation were not being mapped as "single table inheritance", leading to problems when trying to use the mappings further.
* | bulk_updatesMike Bayer2014-11-061-0/+54
| |
* | - add differentiating examples of list() vs. iterationMike Bayer2014-09-161-4/+10
| |
* | - try to finish up the performance example for nowMike Bayer2014-09-065-44/+284
| |
* | - add a test that shows query caching.Mike Bayer2014-09-041-0/+19
| |
* | tweakMike Bayer2014-09-032-6/+9
| |
* | refineMike Bayer2014-09-031-23/+43
| |
* | Merge branch 'master' into ticket_3100Mike Bayer2014-09-031-2/+0
|\ \ | |/
* | - large resultsetsMike Bayer2014-09-034-20/+337
| |
* | - wipMike Bayer2014-09-032-27/+194
| |
* | - lets start exampling this stuffMike Bayer2014-09-022-0/+148
|/
* Materialized paths example.Jack Zhou2014-06-072-0/+131
|
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-262-3/+3
| | | | Found using: https://github.com/intgr/topy
* - Support has been added for pytest to run tests. This runnerMike Bayer2014-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | is currently being supported in addition to nose, and will likely be preferred to nose going forward. The nose plugin system used by SQLAlchemy has been split out so that it works under pytest as well. There are no plans to drop support for nose at the moment and we hope that the test suite itself can continue to remain as agnostic of testing platform as possible. See the file README.unittests.rst for updated information on running tests with pytest. The test plugin system has also been enhanced to support running tests against mutiple database URLs at once, by specifying the ``--db`` and/or ``--dburi`` flags multiple times. This does not run the entire test suite for each database, but instead allows test cases that are specific to certain backends make use of that backend as the test is run. When using pytest as the test runner, the system will also run specific test suites multiple times, once for each database, particularly those tests within the "dialect suite". The plan is that the enhanced system will also be used by Alembic, and allow Alembic to run migration operation tests against multiple backends in one run, including third-party backends not included within Alembic itself. Third party dialects and extensions are also encouraged to standardize on SQLAlchemy's test suite as a basis; see the file README.dialects.rst for background on building out from SQLAlchemy's test platform.