[sqlalchemy] Re: get mapped class

2007-12-22 Thread sdobrev

Alexandre da Silva wrote:
 
 I am already trying go get the list of mapped tables. I currently got a
 list from sqlalchemy.org.mapper from the weakref mapper_registry, but
 I don't know if that values are useful for my context.
what u need?
all tables? see metadata.
all mappers? see the mapper_registry
the relations inbetween? u have to dig the individual mappers, walk the 
polymorphisms and inheritances.

 I also have another question, I have some way to access the mapped class
 from the table object?
probably no, the relation is directional in the other way,. mapper-table; 
one may have many mappers linked in a way or another to same table.
i'm not sure if u can have 2 separate clasess with 2 primary mappers using 
same table - probably can.


and, why u need all this?


 something like:
 
 user_table = Table(...)
 
 class User(object)
   pass
 
 mapper(User, user_table)
 
 I have some method like user_table.getclass? or another way to get it
 from orm?
 
 thank's for help
 
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: get mapped class

2007-12-22 Thread Alexandre da Silva

 what u need?
I need the list of mapped Classes, if mapper_registry have all classes I
can use it.
 all tables? see metadata.
 all mappers? see the mapper_registry
 the relations inbetween? u have to dig the individual mappers, walk the 
 polymorphisms and inheritances.

I just want a list containing the relation class-table and
table-class, but I think it's not available, so I will create my own.

 probably no, the relation is directional in the other way,. mapper-table; 
 one may have many mappers linked in a way or another to same table.
 i'm not sure if u can have 2 separate clasess with 2 primary mappers using 
 same table - probably can.

Creating my own mapping list I will get what I need for now.

 and, why u need all this?

At my development scenario I want to create a Form on application just
defining some properties at Mapped Class, and just what I need is a list
with the links table-class, to get one or other depends where am I, 

other thing I need/want is create some database additional objects
(triggers, procedures, etc) just creating a staticmethod at mapped
class, i.e get_addit_metadata()

that's all
for now I will implement my own mapper function, and it will inside add
the class-table to a list to keep tracking and inside call the
sqlalchemy mapper method.


Thank's for all replies


Best Regards,

Alexandre


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~--~~~~--~~--~--~---