Hi everyone,

I try to update an attribute but it appears that it doesn't save. Would you 
know why ? it's very strange because the print is good. but when I query 
again this uri_reference it finds Nonetype.

here is the command : 

```

@contextlib.contextmanager
def db_session(settings):
    engine = engine_from_config(settings, 'sqlalchemy.')
    session_maker = sessionmaker(bind=engine)
    session = session_maker()
    try:
        yield session
        session.commit()
    except Exception:
        session.rollback()
    finally:
        session.close()


def process(settings):
    """
    Command to migrate urls to a single JSON field for performance issues
    """
    with db_session(settings) as session:
        print ("====================")
        print ("SELECTING ALL IMAGES")
        print ("====================")
        for image in session.query(Image).limit(40).all():
            urls = _list_uri_references_for_data(image.image_metadata)
            urls.append(image.state.actor_uri)
            image.uri_reference = urls
            print ("{}: SAVING -> {}".format(image.name, 
image.uri_reference))
        print ("====================")
        print ("CLOSING SCRIPT")
        print ("====================")
```

Thanks in advance.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to