Commit Graph

143 Commits

Author SHA1 Message Date
Michael Trier 6f1425d04a Cleaned up some long lines to test the commit hooks. 2010-03-07 10:56:11 -05:00
Mike Bayer cb15ab5775 try to clarify intent some more 2010-02-14 18:39:39 +00:00
Mike Bayer a2a3b701c7 - Changed the beaker cache example a bit to have a separate
RelationCache option for lazyload caching.  This object
does a lookup among any number of potential attributes
more efficiently by grouping several into a common structure.
Both FromCache and RelationCache are simpler individually.
2010-02-12 21:43:19 +00:00
Mike Bayer bf6c88fe23 use issubclass here, allows lazy loads from a subclass to hit a loader that was configured on base 2010-01-21 17:40:41 +00:00
Mike Bayer 40f8aadd58 - mega example cleanup
- 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
2010-01-19 00:53:12 +00:00
Mike Bayer 56fe538cc7 some cleanup 2010-01-18 21:47:50 +00:00
Mike Bayer f15eb50a75 sorry, this example is just ridiculous 2010-01-18 21:35:18 +00:00
Mike Bayer 7f91210e94 modernized "adjacencytree" example 2010-01-18 21:29:55 +00:00
Mike Bayer 8a9e2a6c37 updated the large_collection example to modern SQLA. 2010-01-18 20:58:34 +00:00
Mike Bayer 6e6b13b945 local session caching example 2010-01-13 20:42:09 +00:00
Mike Bayer 2d65e9772d add more examples, start basic 2010-01-13 20:00:25 +00:00
Mike Bayer fccc377417 OK, you can't merge NamedTuples and such. Fine. New query method. 2010-01-12 20:27:32 +00:00
Mike Bayer d309827c75 yes you can even set_value(). I'm using it to prepopulate individual "by_id" elements
from a multiple-row SELECT.
2010-01-12 17:51:28 +00:00
Mike Bayer 7fedc9298a have paths represented as their actual mapper, not the base mapper, allowing
more information for custom mapper opts to see what's going on.  add a new _reduce_path()
function to apply to the path as stored in dictionaries, adds a slight cost overhead.
2010-01-11 20:26:34 +00:00
Mike Bayer 513b350ccc add option to hardcode a cache key 2010-01-11 17:16:59 +00:00
Mike Bayer 7b1631fea1 compare class in the given path with our own class using issubclass, since paths
are always against the base class
2010-01-11 17:12:04 +00:00
Mike Bayer 79e5c5087a memcached wants this 2010-01-11 16:59:16 +00:00
Mike Bayer 01e9a49613 ensure criterion is not None 2010-01-11 16:10:11 +00:00
Mike Bayer f4b143685c - cut down on a few hundred method calls 2010-01-11 03:16:10 +00:00
Mike Bayer b729503a3e - merge() will not issue a needless merge of attributes if the
given instance is the same instance which is already present.

- merge() now also merges the "options" associated with a given
state, i.e. those passed through query.options() which follow
along with an instance, such as options to eagerly- or
lazyily- load various attributes.   This is essential for
the construction of highly integrated caching schemes.  This
is a subtle behavioral change vs. 0.5.

- A bug was fixed regarding the serialization of the "loader
path" present on an instance's state, which is also necessary
when combining the usage of merge() with serialized state
and associated options that should be preserved.

- The "query_cache" examples have been removed, and are replaced
with a fully comprehensive approach that combines the usage of
Beaker with SQLAlchemy.  New query options are used to indicate
the caching characteristics of a particular Query, which
can also be invoked deep within an object graph when lazily
loading related objects.  See /examples/beaker_caching/README.
2010-01-10 21:21:45 +00:00
Mike Bayer 5f6ed1a3f8 - pg8000 + postgresql dialects now check for float/numeric return
types to more intelligently determine float() vs. Decimal(),
[ticket:1567]
- since result processing is a hot issue of late, the DBAPI type
returned from cursor.description is certainly useful in cases like
these to determine an efficient result processor.   There's likely
other result processors that can make use of it.  But, backwards
incompat change to result_processor().  Happy major version number..
2009-11-15 19:20:22 +00:00
Mike Bayer ed83a844bb - Fixed a slight inaccuracy in the sharding example.
Comparing equivalence of columns in the ORM is best
accomplished using col1.shares_lineage(col2).
[ticket:1491]
2009-10-25 01:40:23 +00:00
Mike Bayer 8fc5005dfe merge 0.6 series to trunk. 2009-08-06 21:11:27 +00:00
Michael Trier 34aaabf7ea Added in Examples into the test suite so they get exercised regularly. Cleaned up some deprecation warnings in the examples. 2009-07-27 02:12:15 +00:00
Michael Trier b5ad47271e Cleaned up the deprecation problems with the examples. 2009-04-13 03:23:19 +00:00
Michael Trier 6010afb28f Lots of fixes to the code examples to specify imports explicitly.
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.
2009-03-31 22:31:08 +00:00
Mike Bayer 60dd7842f0 - Added "post_configure_attribute" method to InstrumentationManager,
so that the "listen_for_events.py" example works again.
[ticket:1314]
2009-02-11 18:23:35 +00:00
Mike Bayer 023cc62bfc - sqlalchemy.sql.expression.Function is now a public
class.  It can be subclassed to provide user-defined
SQL functions in an imperative style, including
with pre-established behaviors.  The postgis.py
example illustrates one usage of this.
2009-01-02 19:45:05 +00:00
Mike Bayer 50dfbc7e79 - Custom comparator classes used in conjunction with
column_property(), relation() etc. can define
new comparison methods on the Comparator, which will
become available via __getattr__() on the
InstrumentedAttribute.   In the case of synonym()
or comparable_property(), attributes are resolved first
on the user-defined descriptor, then on the user-defined
comparator.
2009-01-02 18:22:50 +00:00
Mike Bayer 96c76ec79e - added an extremely basic illustration of a PostGIS
integration to the examples folder.
2008-12-30 20:38:32 +00:00
Mike Bayer a5dfbeedb9 - Improved the behavior of aliased() objects such that they more
accurately adapt the expressions generated, which helps
particularly with self-referential comparisons. [ticket:1171]

- Fixed bug involving primaryjoin/secondaryjoin conditions
constructed from class-bound attributes (as often occurs
when using declarative), which later would be inappropriately
aliased by Query, particularly with the various EXISTS
based comparators.
2008-11-03 02:52:30 +00:00
Mike Bayer baa9006c28 remove erroneous comments 2008-10-24 19:43:29 +00:00
Mike Bayer eba763b258 two more cache examples 2008-10-24 19:41:25 +00:00
Mike Bayer 16dd8aab74 "nested sets" example. needs work. 2008-09-18 22:14:29 +00:00
Mike Bayer 0fbb67b71a synchronize inherited does not need to be called for the full mapper hierarchy 2008-09-05 15:23:44 +00:00
Mike Bayer 3829b89d69 - column_property(), composite_property(), and relation() now
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
2008-09-02 19:51:48 +00:00
Mike Bayer 3e25e6e6b0 - AttributeListener has been refined such that the event
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.
2008-09-02 17:57:35 +00:00
Mike Bayer 4c6c996f9b - add an example illustrating attribute event reception. 2008-08-29 16:15:41 +00:00
Jason Kirtland 05ac1efe0d Applied .append(x, **kw) removal patch from [ticket:1124] and general cleanup. 2008-08-15 23:33:43 +00:00
Mike Bayer cc87685c93 removing this example until further notice (append_result() not an easy road to travel) 2008-08-15 22:57:14 +00:00
Mike Bayer 01bce5c129 fix adjacency list examples 2008-07-14 19:44:37 +00:00
Gaëtan de Menten b2edf4a0fd typo 2008-07-11 07:39:21 +00:00
Gaëtan de Menten 7ade777df2 update poly_assoc examples for 0.4+ syntax 2008-07-03 13:19:31 +00:00
Mike Bayer 8755dc3d66 - fixed up vertical.py
- Fixed query.join() when used in conjunction with a
columns-only clause and an SQL-expression
ON clause in the join.
2008-06-28 15:23:08 +00:00
Mike Bayer 3cd10102e4 - Query.UpdateDeleteTest.test_delete_fallback fails on mysql due to subquery in DELETE; not sure how to do this exact operation in MySQL
- added query_cls keyword argument to sessionmaker(); allows user-defined Query subclasses to be generated by query().
- added @attributes.on_reconstitute decorator, MapperExtension.on_reconstitute, both receieve 'on_load' attribute event allowing
non-__init__ dependent instance initialization routines.
- push memusage to the top to avoid pointless heisenbugs
- renamed '_foostate'/'_fooclass_manager' to '_sa_instance_state'/'_sa_class_manager'
- removed legacy instance ORM state accessors
- query._get() will use _remove_newly_deleted instead of expunge() on ObjectDeleted, so that transaction rollback
restores the previous state
- removed MapperExtension.get(); replaced by a user-defined Query subclass
- removed needless **kwargs from query.get()
- removed Session.get(cls, id); this is redundant against Session.query(cls).get(id)
- removed Query.load() and Session.load(); the use case for this method has never been clear, and the same functionality is available in more explicit ways
2008-06-09 01:24:08 +00:00
Mike Bayer 86ded90c6e make Query._clone() class-agnostic 2008-06-02 15:32:17 +00:00
Mike Bayer c998539b40 illustrates a simple Query "hook" to implement query caching. 2008-06-02 15:27:38 +00:00
Mike Bayer 4a6afd469f r4695 merged to trunk; trunk now becomes 0.5.
0.4 development continues at /sqlalchemy/branches/rel_0_4
2008-05-09 16:34:10 +00:00
Mike Bayer 30f55a5016 - added an example dynamic_dict/dynamic_dict.py, illustrating
a simple way to place dictionary behavior on top of
a dynamic_loader.
2008-05-07 14:48:04 +00:00
Jason Kirtland c37ed5cbb3 - Added comparable_property(), adds query Comparator behavior to regular, unmanaged Python properties
- Some aspects of MapperProperty initialization are streteched pretty thin now
  and need a refactor; will proceed with these on the user_defined_state branch
2008-03-17 22:06:49 +00:00