summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-10-17 18:11:21 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-10-17 18:11:21 +0000
commit4d2be119f05ef2dfb431830f142e7502da418e93 (patch)
tree295fd6b21b85c7770477c502e80ab71e0818072c /doc
parent9e74371d5320e11f34ee5009267174f5a5c482b4 (diff)
downloadsqlalchemy-4d2be119f05ef2dfb431830f142e7502da418e93.tar.gz
synonym does not create the proxying behavior unless the flag 'proxy=True' is set up
Diffstat (limited to 'doc')
-rw-r--r--doc/build/content/adv_datamapping.txt16
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/build/content/adv_datamapping.txt b/doc/build/content/adv_datamapping.txt
index 5b16c9072..e46387c16 100644
--- a/doc/build/content/adv_datamapping.txt
+++ b/doc/build/content/adv_datamapping.txt
@@ -84,7 +84,7 @@ A common request is the ability to create custom class properties that override
'_email': mytable.c.email
})
-It is also possible to use the `select_by` and `get_by` functions on `Query` using the original property name, by establishing a `synonym`:
+It is also possible to route the the `select_by` and `get_by` functions on `Query` using the new property name, by establishing a `synonym`:
{python}
mapper(MyClass, mytable, proeprties = {
@@ -99,6 +99,20 @@ It is also possible to use the `select_by` and `get_by` functions on `Query` usi
# now you can select_by(email)
result = session.query(MyClass).select_by(email='john@smith.com')
+Synonym can be established with the flag "proxy=True", to create a class-level proxy to the actual property:
+
+ {python}
+ mapper(MyClass, mytable, proeprties = {
+ '_email': mytable.c.email
+ 'email' : synonym('_email', proxy=True)
+ })
+
+ x = MyClass()
+ x.email = 'john@doe.com'
+
+ >>> x._email
+ 'john@doe.com'
+
The `synonym` keyword is currently an [Alpha Feature][alpha_api].
#### Custom List Classes {@name=customlist}