Hi,

I'm new to sqlalchemy, writing my first app using it. I stumbled upon a 
weird thing; my user object has a pyckletype representing a python dict, 
which i can't find a way to update. I assumed, that a change in the pickled 
object will somehow trigger "dirty" and my new data should be there, but it 
is not. My goal would be to create an user, and a notebook for the user, 
then add the notebook's ID to the user.views['lastopened'] 

Looking at the code it will be clear i hope (i'm adding some comments here):

            newuser = User(email,name,password)                             
   # creating the new user 
            newuser.notebooks.append(Notebook("My Notes"))               # 
the child notebook 
            newuser.views = {}
            session.add(newuser)    
            session.commit()     # couldn't find other way to get the 
notebook id, but to make a commit. is there a better way?
            
            user = session.query(User).filter_by(email=email).one()         
# I'm not sure if a new query is needed here, this is 
eliminating uncertainty 
            defaultnb = user.notebooks[0]
            user.views['lastview'] =  defaultnb.id
            session.commit()
            session.close()

the problem is, that the user.view['lastview'] stays an empty {} ... if i 
update it upon creation, it works, but then the notebook.id is not known to 
me.

Any advice is highly appreciated!
thanks
Zoltan

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to