| 123 | | Not many, but exactly what we expected. Close the interpreter now and delete the database file (`movies.sqlite`)^4^, we will recreate and populate it in the next step. |
| 124 | | |
| 125 | | So far you've seen how to declare simple entities, create objects, store them |
| | 123 | Not many, but exactly what we expected. This can be used to access your objects: |
| | 124 | |
| | 125 | {{{ |
| | 126 | #!python |
| | 127 | >>> movie = Movie.query.all()[0] |
| | 128 | >>> movie.year = 1983 |
| | 129 | >>> movie = Movie.query.all() |
| | 130 | [<Movie "Blade Runner" (1983)>] |
| | 131 | }}} |
| | 132 | |
| | 133 | Or even delete it: |
| | 134 | |
| | 135 | {{{ |
| | 136 | #!python |
| | 137 | >>> Movie.delete(movie) |
| | 138 | }}} |
| | 139 | |
| | 140 | There should not be any movie left in the database now ! |
| | 141 | |
| | 142 | {{{ |
| | 143 | #!python |
| | 144 | >>> Movie.query.all() |
| | 145 | [] |
| | 146 | }}} |
| | 147 | |
| | 148 | Close the interpreter now and delete the database file (`movies.sqlite`)^4^, we will recreate and populate it in the next step. |
| | 149 | |
| | 150 | So far you've seen how to declare simple entities, create objects, store them, modify them, or even delete them, |