Пример #1
0
"""
ct = Actor.query.count()
plog("Actor Count via .count(): {0} ".format(ct))


"""
Demo #2

Add a new Actor to the database
Verify that it's added

"""
rick = Actor()
rick.first_name = "Rick"
rick.last_name = "Harding"

session.add(rick)
# notice that we flush here, but we don't commit. The change won't actually
# make it to the db so when we rerun this script, it'll still report 200/201
session.flush()

ct = Actor.query.count()
plog("Inserted Rick, New Count: {0} ".format(ct))


"""
Homework

Now that the new actor 'Rick' is added, remove him and verify that you get back
200 actors in the database