January 2015
Intermediate to advanced
198 pages
4h 27m
English
Now that we know how to connect to a Cloud SQL instance from our App Engine application, it's time to learn how to write and read data from the database. We already created a table called ops, and we will use it to store information about user operations. We will log the following events:
We have to assign a text code to each of the operation types we want to log. To do so, we can use a simple Python class that works as an enumeration. In the utils.py module, we add the following code:
class OpTypes(object):
NOTE_CREATED = 'NCREATED'
FILE_ADDED = 'FADDED'
SHRINK_PERFORMED = 'SHRINKED'We will see how to use it in a moment. We now provide ...
Read now
Unlock full access