summaryrefslogtreecommitdiff
path: root/examples/custom_attributes
Commit message (Collapse)AuthorAgeFilesLines
* ensure single import per lineMike Bayer2023-02-282-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the very small plugin flake8-import-single which will prevent us from having an import with more than one symbol on a line. Flake8 by itself prevents this pattern with E401: import collections, os, sys However does not do anything with this: from sqlalchemy import Column, text Both statements have the same issues generating merge artifacts as well as presenting a manual decision to be made. While zimports generally cleans up such imports at the top level, we don't enforce zimports / pre-commit use. the plugin finds the same issue for imports that are inside of test methods. We shouldn't usually have imports in test methods so most of them here are moved to be top level. The version is pinned at 0.1.5; the project seems to have no activity since 2019, however there are three 0.1.6dev releases on pypi which stopped in September 2019, they seem to be experiments with packaging. The source for 0.1.5 is extremely simple and only reveals one method to flake8 (the run() method). Change-Id: Icea894e43bad9c0b5d4feb5f49c6c666d6ea6aa1
* pep484: attributes and relatedMike Bayer2022-05-031-3/+6
| | | | | | | also implements __slots__ for QueryableAttribute, InstrumentedAttribute, Relationship.Comparator. Change-Id: I47e823160706fc35a616f1179a06c7864089e5b5
* Remove object in class definitionFederico Caselli2021-11-222-2/+2
| | | | | References: #4600 Change-Id: I2a62ddfe00bc562720f0eae700a497495d7a987a
* 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
* Post black reformattingMike Bayer2019-01-061-18/+14
| | | | | | | | | | | | | 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-064-45/+62
| | | | | | | | | | | | | | 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
* - fix formatting on examples to list the description first, some flake8Mike Bayer2018-12-071-2/+1
| | | | 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 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
* - add a new sphinx extension "viewsource". takes advantage of part of the ↵Mike Bayer2013-11-091-13/+1
| | | | | | | | | viewcode extension to allow ad-hoc display of the source of any file, as well as a "directory listing" structure. - reorganize examples/ to take advantage of new extension. in particular, keep moving all the descriptive text for files etc. into module docstrings, taking more advantage of self-documentation.
* - the raw 2to3 runMike Bayer2013-04-271-1/+1
| | | | - went through examples/ and cleaned out excess list() calls
* modernize some more examplesMike Bayer2013-04-272-5/+6
|
* fixing InstrumentationManager linksDiana Clarke2012-12-071-3/+14
|
* -whitespace bonanza, contdMike Bayer2012-07-281-7/+7
|
* - [moved] The InstrumentationManager interfaceMike Bayer2012-06-241-108/+11
| | | | | | | | | | | | | and the entire related system of alternate class implementation is now moved out to sqlalchemy.ext.instrumentation. This is a seldom used system that adds significant complexity and overhead to the mechanics of class instrumentation. The new architecture allows it to remain unused until InstrumentationManager is actually imported, at which point it is bootstrapped into the core.
* fix a usage issue hereMike Bayer2012-01-281-0/+3
|
* - whitespace removal bonanzaMike Bayer2011-01-022-9/+9
|
* - removes the "on_" prefix.Mike Bayer2010-12-301-4/+4
|
* new calling style: event.listen(target, identifier, fn)Mike Bayer2010-12-011-4/+4
|
* - merge tipMike Bayer2010-11-061-25/+35
|\
| * - remove remaining create_session() calls from examples, replace with SessionMike Bayer2010-10-241-25/+35
| | | | | | | | - replace all flush()/expunge_all() with commit()
* | - add instrumentation eventsMike Bayer2010-10-021-33/+17
| | | | | | | | | | | | | | | | | | - simplify listen_for_events example with new system - add "propagate", "retval", "raw" flags to attribute events. this solves the "return value" issue as well as the "subclass" issue. - begin thinking about event removal. Each listen() method will have a corresponding remove(). Custom listen() methods will have to package all the info onto the event function that is needed to remove its state.
* | - reorganizationMike Bayer2010-09-141-1/+2
|/ | | | | | | - attrbutes.py splits into attribtes.py and instrumentation.py - all the various Event subclasses go into events.py modules - some ideas for orm events - move *Extension out to deprecated_interfaces
* Python-tidy test/engine and test/aaa_profiling, 80% auto + 20% manual ↵Mike Bayer2010-07-111-1/+2
| | | | intervention
* typoChris Withers2010-07-081-1/+1
|
* fix some examplesMike Bayer2010-03-281-3/+3
|
* - The official name for the relation() function is nowMike Bayer2010-03-172-4/+4
| | | | | | relationship(), to eliminate confusion over the relational algebra term. relation() however will remain available in equal capacity for the foreseeable future. [ticket:1740]
* - mega example cleanupMike Bayer2010-01-192-0/+9
| | | | | | - added READMEs to all examples in each __init__.py and added to sphinx documentation - added versioning example - removed vertical/vertical.py, the dictlikes are more straightforward
* Added in Examples into the test suite so they get exercised regularly. ↵Michael Trier2009-07-271-0/+0
| | | | Cleaned up some deprecation warnings in the examples.
* Lots of fixes to the code examples to specify imports explicitly.Michael Trier2009-03-312-8/+10
| | | | | | | Explicit imports make it easier for users to understand the examples. Additionally a lot of the examples were fixed to work with the changes in the 0.5.x code base. One small correction to the Case expression. Thanks a bunch to Adam Lowry! Fixes #717.
* - Added "post_configure_attribute" method to InstrumentationManager,Mike Bayer2009-02-111-2/+1
| | | | | so that the "listen_for_events.py" example works again. [ticket:1314]
* - column_property(), composite_property(), and relation() nowMike Bayer2008-09-022-118/+2
| | | | | | | | | | accept a single or list of AttributeExtensions using the "extension" keyword argument. - Added a Validator AttributeExtension, as well as a @validates decorator which is used in a similar fashion as @reconstructor, and marks a method as validating one or more mapped attributes. - removed validate_attributes example, the new methodology replaces it
* - AttributeListener has been refined such that the eventMike Bayer2008-09-022-2/+121
| | | | | | | | | | | | is fired before the mutation actually occurs. Addtionally, the append() and set() methods must now return the given value, which is used as the value to be used in the mutation operation. This allows creation of validating AttributeListeners which raise before the action actually occurs, and which can change the given value into something else before its used. A new example "validate_attributes.py" shows one such recipe for doing this. AttributeListener helper functions are also on the way.
* - add an example illustrating attribute event reception.Mike Bayer2008-08-291-0/+83
|
* r4695 merged to trunk; trunk now becomes 0.5.Mike Bayer2008-05-091-0/+190
0.4 development continues at /sqlalchemy/branches/rel_0_4