On Sun, Apr 09, 2006 at 12:58:16AM +0200, Sandro Dentella wrote:
> Hi all, 
> 
>   i'm stil trying to understand the whole thing, be patient please...
> 
>   below I report a complete sqlite example that I don't really
>   understand. It's mapper with 2 relations:
> 
>    m = mapper(User, users, properties = { 'addr': rel, 'cities' : rel2 } )
> 
>   what I don't understand is that property 'addr' and 'cities' appear to be
>   different to my understanding. An example is the fact that 'addr' property
>   is 'sizable' and has a count() method), while 'cities' do not.
> 
>   Why is this this way? 
> 
>   I arrived here while trying to get a print of all sql-rows as if I used the
>   join from the command line. Is there a standard solution when you don't know
>   in advance which are the properties? (I'm writing a tool that should "edit
>   a mapper result" getting all used info from the result and the mapper).

I try to argument a little more precisely my problem. 

I'm evaluating if an ORM -sqlalchemy in particular- is the instrument suited
for my project (rewriting TkSql - www.tksql.org in pygtk). Rewriting these
library from scratch and in python I hope to add extra functionality that I
culd not write when I wrote tksql, as real editing of join rowsets and hooks
for many different databases engines.

While the mapper objects (I'm normally using autoload=True) give me a huge
quantity of usefull info I'm still evaluating how to properly use rowset
returned from mapper.select().

In the cases I need to represent the resulting rowset in a table to allow
peple to edit them. I don't find it any easy to loop over the result object,
using the attributes and respecting the order the db outputs the rowset (I
think mapper.select doesn't have an 'order by' option, probably due to the
way it handles return data?)

 Which is the correct way to print the rowset?
 Is there a way to loop over the complete rowset?

While it is pretty easy in the case user/address (apart from the ordering),
I don't see how to loop when multiple relations/properties where added
creating the mapper as in the example at the beginning of this e-mail: the
objects attached to the user-object under the property 'addr' is different
from that under the property 'cities' (different methods, .count() is present
only in 'addr', not in 'cities').

Thanks for your attention
sandro

--
Sandro Dentella  *:-)
e-mail: [EMAIL PROTECTED] 
http://www.tksql.org                    TkSQL Home page - My GPL work


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to