There is nothing automagically special about the filename models.py. A
project may have many models throughout its codebase in arbitrarily-named
files. Files implementing models often have model in their filenames
(or they may live in a Python subpackage of your application package named
models) , but this is only by convention.

Open tutorial/tutorial/models.py file and edit it to look like the
following:

As you can see, our Page class has a class level attribute
__tablename__ which equals the string 'pages'. This means that
SQLAlchemy will store our wiki data in a SQL table named pages. Our Page
class will also have class-level attributes named id, name and
data (all instances of sqlalchemy.Column). These will map to
columns in the pages table. The id attribute will be the primary key
in the table. The name attribute will be a text attribute, each value of
which needs to be unique within the column. The data attribute is a text
attribute that will hold the body of each page.

We haven’t looked at the details of this file yet, but within the scripts
directory of your tutorial package is a file named initializedb.py. Code
in this file is executed whenever we run the initialize_tutorial_db command
(as we did in the installation step of this tutorial).

Since we’ve changed our model, we need to make changes to our initializedb.py
script. In particular, we’ll replace our import of MyModel with one of
Page and we’ll change the very end of the script to create a Page
rather than a MyModel and add it to our DBSession.

Open tutorial/tutorial/scripts/initializedb.py and edit it to look like the
following:

Because our model has changed, in order to reinitialize the database, we need
to rerun the initialize_tutorial_db command to pick up the changes you’ve made
to both the models.py file and to the initializedb.py file. From the root of the
tutorial project, directory execute the following commands.

We can’t. At this point, our system is in a “non-runnable” state; we’ll need
to change view-related files in the next chapter to be able to start the
application successfully. If you try to start the application (See
Starting the Application), you’ll wind
up with a Python traceback on your console that ends with this exception: