summaryrefslogtreecommitdiff
path: root/examples/association/__init__.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-01-19 00:53:12 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-01-19 00:53:12 +0000
commit40f8aadd582776524d3b98da1f577c2fc95619e7 (patch)
tree753eec3802734f397953976824a252bb60829189 /examples/association/__init__.py
parent56fe538cc7d81ce264fc6504feb1ead5e17d0f55 (diff)
downloadsqlalchemy-40f8aadd582776524d3b98da1f577c2fc95619e7.tar.gz
- 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
Diffstat (limited to 'examples/association/__init__.py')
-rw-r--r--examples/association/__init__.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/association/__init__.py b/examples/association/__init__.py
index e69de29bb..46b596991 100644
--- a/examples/association/__init__.py
+++ b/examples/association/__init__.py
@@ -0,0 +1,25 @@
+"""
+
+Examples illustrating the usage of the "association object" pattern,
+where an intermediary object associates two endpoint objects together.
+
+The first example illustrates a basic association from a User object
+to a collection or Order objects, each which references a collection of Item objects.
+
+The second example builds upon the first to add the Association Proxy extension.
+
+E.g.::
+
+ # create an order
+ order = Order('john smith')
+
+ # append an OrderItem association via the "itemassociations"
+ # collection with a custom price.
+ order.itemassociations.append(OrderItem(item('MySQL Crowbar'), 10.99))
+
+ # append two more Items via the transparent "items" proxy, which
+ # will create OrderItems automatically using the default price.
+ order.items.append(item('SA Mug'))
+ order.items.append(item('SA Hat'))
+
+""" \ No newline at end of file