hey gambit -
a cohesive error message begins as what it literally is before it can
be refined into a more descriptive case, based on observation of what
actually makes it occur. when i wrote that message, i had no idea
what conditions would create it. now we are getting a better idea so
its a candidate for a text change, along the lines of "primary join
does not contain required table 'X'". does that help ?
On Apr 23, 2006, at 4:13 PM, Gambit wrote:
Hey Mike,
Speaking from a debugging point of view, it might be useful if
error messages
get more text then just "it failed, and died". Even if you just
attached your
paragraph at the bottom starting "So when the..." either to the
error itself
(always useful!) or somewhere in the docs (which, docstrings or no,
don't have
any instances of 'syncrule' in them) it would put that snippet in
the first
couple of places someone encountering the error is going to look.
So maybe a
"Error Messages" section at the end of the docs?
-G
On Sunday, April 23, 2006, 9:42:49 PM, you wrote:
a syncrule is an object generated internally when you associate one
Mapper with another Mapper via a relation(), which is actually an
object called a PropertyLoader.
so lets use the Users/Address example. say we have classes User and
Address. the join condition is
users.c.user_id==addresses.c.user_id . When you attach the Address
to the User and do a save, the "user_id" property of the User object
is copied to the Address object. That is done by a syncrule. The
syncrule is generated at mapper construction time by looking at the
tables inside of "users.c.user_id==addresses.c.user_id", i.e. "users"
and "addresses", matching those up to the mappers for the User and
Address classes, and correlating the "user_id" column to the
appropriate attribute in the User and Address class. the SyncRule
then has an execute() method that is called at save time, which
copies a single attribute from source to destination, in this case
copying the "user_id" attribute from a User object to an Address
object.
So when the relation system has that error with "no syncrules
generated", its a sign that the join conditions of the relationship
do not correspond to the tables represented by the mappers.
the code for this is pretty well isolated and docstring'ed in the
module sqlalchemy.mapping.sync, containing the two objects
ClauseSynchronizer and SyncRule.
On Apr 23, 2006, at 1:50 PM, Gambit wrote:
Hey All,
For the line:
Customer.mapper.add_property('checkout_history', relation
(CheckoutEntry.mapper, t_customer_tours,
primaryjoin=Customer.c.cust_id==CustomerTour.c.cust_id,
secondaryjoin=and_(CustomerTour.c.start_date <=
CheckoutEntry.c.ts_checkout,
CoreDb.CustomerTour.c.finish_date >= CheckoutEntry.c.ts_checkout)))
it generates the following error:
ArgumentError: No syncrules generated for join criterion
customer_tours.start_date <= checkout_trail.ts_checkout AND
customer_tours.finish_date >= checkout_trail.ts_checkout
It turns out that that property is, well, not what I wanted in the
first place
(there's no explicit 1:1 relationship between Customer and
CustomerTour,
amongst other things) but I am pretty curious what a syncrule is,
what causes
it to be generated (or not generated), and, if I encounter it
again, what
should I look for?
I'm sure it must make sense to /someone/, but as a user I'm left
scratching my
head :)
Cheers,
-G
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your
job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your
job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users