Pardon my probably misuse of terminology in my question below. I've
just begun to use SA and am still learning what to call everything :)

Overview:
I want to create an object in one HTTP request and then retrieve it in
a second HTTP request, update it, and finally insert it all to the DB.
Yes, this is in a Django app, but the model History() below is an
Elixir entity.

OK, so I am creating an object, modifying it, and saving it to the
session like this:

# History is an Elixir object subclassed from Entity
history = History()
history.account_id = account_id
session.save(history)

# pickle the object
history_pickle = pickle.dumps(history)

# pickle is then stored in the HTTP session
request.session['history_object'] = history_pickle

Now, in a subsequent HTTP request, I take that object out of the
session and "depickle" it.

history = pickle.loads(request.session['history_object'])

# merge the existing object back into the session
session.merge(history)

# make further modifications to object
history.user_id = user_id
...
session.save(history)
session.flush()

When I do this, I receive this error that seems to occur on the merge():
Class 'History' entity name 'None' has no mapper associated with it.

I've tried supplying an entity name in the merge() call, but I'm
unsure what that name should be. I also toyed with the dont_load=True
attribute since (if I understand save() correctly) this history object
will not exist as a row in the DB.

Can someone point in the right direction here with what I am trying to do?

Thanks!

/alex

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