On Thursday 19 June 2008 20:38:08 zipito wrote:
> On 19 июн, 20:12, [EMAIL PROTECTED] wrote:
> > once mapped, the link is the otherway around:
> >  class -> mapper -> sqltable.
> > the backlink... u have to cache it yourself when u create things?
> > e.g. mytablemap[tablename,schemaname]=TableClass
> >
> > why need that? i mean why starting from tablename?
>
> 'cause mine application is designed in such way - every record in
> the database is the document with it's unique id. (additionally
> with rights) there is document_types reference which shows the
> document_types with its location in database - so user clicks - i
> want to get the content of the object - and receives the exact
> content - but in methods i define additional filters. So this would
> be great to make working
where u get the tablename from?
i dont get it but it's your app so whatever. 

> so creating own tables cache... that's a solution... but I've been
> thinking there is something which would help me.
>
>
> Additional question (maybe of the topic of mine base question)
>
> when I autogenerate the table from the database and then map it to
> the TableClass how can I get the object from one-to-many relation??
u'll probably get foreign keys etc sql-schema stuff but actual mapper 
relations u have to do yourself. maybe guessing from foreign keys, i 
dont know. 
there is sqlsoup - http://www.sqlalchemy.org/trac/wiki/SqlSoup - which 
may do what u want.


> i.e. 2 simple tables with 1 to many relation autogenerated.
>
> table1 = Table(..., autogenerate=True)
> class Table1Class(object):
>     pass
>
> table2 = Table(..., autogenerate=True)
> class Table2Class(object):
>     pass
>
>
> mapper(Table1Class, table1)
> mapper(Table2Class, table2)
>
>
>
> so would be genereated there the one-to-many relation between
> Table1Class and Table2Class??
>
> If yes - how to get all subsequent records from slave (Table2Class)
> table from instance of master table(Table1Class)
>
> table1ref = Table1Class()
>
> table2refs = table1ref.getall_table2_subsequent()
>
>
> ???
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to