u need to recreate the same graph of objects on the client side
without the db underneath?
just serialize all the objects u have then and send them over.
what is to be serialized - maybe something like
dict( (p.key, getattr(obj,key) )
for p in object_mapper(obj).iter_properties )
for each obj
On Friday 27 June 2008 19:23:57 Petr Dlabal wrote:
> I don't understand how can remote client application have the same
> mapper setup in situation where there is no direct connection to
> database to reflect the tables and map to the classes.
> In addition at the server side the classes are declared only like
> class XYZ(object):pass and the internal structure of the class is
> created from reflected (autoload) tables.
> Maybe I missed something, but I think, that I need the engine
> connected to database and then metadata to map the classes and get
> their internal structure (from reflected (autoload) tables) - but
> the client side cannot connect to database.
> I don't know what means "declarative" extension. This is the part
> of the mapping code at server side:
>
> class KLASS(object):pass
> class SUBKLASS(object):pass
> class SUBSUBKLASS(object):pass
>
> table_T = Table('table', metadata,autoload = True)
> subtable_T = Table('subtable', metadata,autoload = True)
> subsubtable_T = Table('subsubtable', metadata, autoload = True)
>
> mapper(KLASS,table_T,properties={'atr':relation(SUBKLASS,lazy=False
>)})
> mapper(SUBKLASS,subtable_T,properties={'subatr':relation(SUBSUBKLAS
>S,lazy=False)}) mapper(SUBSUBKLASS,subsubtable_T)
>
> So, I don't understand how to repeat this definitions at client
> side if there is no database connection (no metadata etc.)
>
> Thank you very much, btw SQLAlchemy is great, although I'm not
> programmer so I have never seen any ORM before :-)
>
> Peter
>
> On Fri, Jun 27, 2008 at 3:56 PM, Michael Bayer
<[EMAIL PROTECTED]> wrote:
> > On Jun 27, 2008, at 3:25 AM, Nabla wrote:
> >> Is there some easy solution of this problem?
> >
> > yes, the receiving application needs to have the same mapper()
> > setup as the sender. If you use the "declarative" extension to
> > setup your classes, this task is made easier.
> >
> >> And additional question - is there some "simple" way how to
> >> "convert" (marshal, serialize) reflected sqlalchemy class to
> >> "human- readable" XML?
> >
> > we dont have an XML serializer but there might be something on
> > Pypi for that.
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---