Hi,
I'm new in SQLAlchemy (and also in Python in fact), can anyone help me
with this (maybe silly) problem, please (it's just experiments, so
please don't say - use framework XY instead your solution):
Situation:

- I have SimpleXMLRPCServer up and running (based on xmlrpclib) -
working ok.

- I have PostgreSQL database and script with SQLAlchemy mapping to
classes with autoload = True - reflecting, so there is no class
definition, just: class NAME(object):pass

- mapped class is nested because of relations, for example:
mapper(KLASS,klasstab, properties =
'rel1':relation(SUBKLASS,lazy=False)}) - this works ok, so there is
KLASS().rel1[0].attribute.something construction possible.

- I need to process some data from database with SQLAlchemy help on
XMLRPC server with remote procedure and send it to client.

Problems:
- xmlrpclib cannot marshall new-style class
- SQLAlchemy cannot use old-style class
So I tried to pickle the SQLAlchemy reflected class and send it by
XMLRPC after pickling - this works, if there is lazy=False. But client
doesn't know the structure of the reflected class, so it cannot be
unpickled... I get this traceback while unpickling at client side:

Traceback (most recent call last):
  File "C:\Documents and Settings\...\xmlrpctest2\client.py", line 72,
in <module>
    xx = pickle.loads(a)
  File "c:\python25\lib\pickle.py", line 1374, in loads
    return Unpickler(file).load()
  File "c:\python25\lib\pickle.py", line 858, in load
    dispatch[key](self)
  File "c:\python25\lib\pickle.py", line 1217, in load_build
    setstate(state)
  File "c:\python25\lib\site-packages\SQLAlchemy-0.4.5-py2.5.egg
\sqlalchemy\orm\collections.py", line 610, in __setstate__
    self.attr = getattr(d['owner_state'].obj().__class__,
d['key']).impl
AttributeError: type object 'SUBKLASS' has no attribute 'attributes'

Is there some easy solution of this problem?
And additional question - is there some "simple" way how to
"convert" (marshal, serialize) reflected sqlalchemy class to "human-
readable" XML?
Thanks for any answer

Peter


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to