Updating an object with bottle + elixir (sqlalchemy) not being saved
===

I am creating an object and then updating it later.

The update code looks like:

    def start_instance(reservation):
    	
        server = nova.servers.create(flavor=FLAVOR,image=IMAGE,name=NAME)

	    if server:
	        reservation.instance_id = server.id		
	        session.commit()
	        return True

and the reservation.instance_id is set but only for a few minutes, or until I stop the server. I'm guessing this has something to do with sessions, but I am having a hard time narrowing down exactly what is wrong with the sessions.

Even if I do it from a little command line program it still doesn't take. Below I create a reservation object, wait for awhile while a server is created, and then once I have the server id update the reservation with that id. For that session, it seems?, I have the reservation.id but then once the test_reservation.py script finishes I query the reservation object to see if it has an id, but it does not.

    [vagrant@WEBSERVER:~/labinski] python test_reservation.py 
    No handlers could be found for logger "apscheduler.jobstores.sqlalchemy_store"
    binding db..
    => Getting student...
    => Getting class...
    => Getting image...
    => Setting reservation....
    /usr/lib64/python2.6/site-packages/sqlalchemy/engine/default.py:473: SAWarning: Unicode type received non-unicode bind param value.
      processors[key](compiled_params[key])
        ...success!
    => Printing initial job values
        r id 1
        r start: student_curtis_class_EDMATH 502_reservation_id_1_start
        r check: student_curtis_class_EDMATH 502_reservation_id_1_check
        r warn: student_curtis_class_EDMATH 502_reservation_id_1_warn
        r stop: student_curtis_class_EDMATH 502_reservation_id_1_stop
        r instance: None
    => sleeping 62 seconds to wait for instance_id of server...
    => Printing job values after intance creation...
        r id 1
        r start: student_curtis_class_EDMATH 502_reservation_id_1_start
        r check: student_curtis_class_EDMATH 502_reservation_id_1_check
        r warn: student_curtis_class_EDMATH 502_reservation_id_1_warn
        r stop: student_curtis_class_EDMATH 502_reservation_id_1_stop
        r instance: 31cf939c-3be9-4fb4-9fb8-09a45b1d98ce

    # now query the reservations again...
    [vagrant@WEBSERVER:~/labinski] manage listreservations
    No handlers could be found for logger "apscheduler.jobstores.sqlalchemy_store"
    binding db..
    binding db..
    => Reservations...
    student_name:curtis;res_id:1;image_id:0f53de4a-1bb6-43bd-a567-fe181b25cfbe;instance_id:None

Thanks for any help!

PS. All the code can be seen in this repository: https://github.com/curtisgithub/labinski