Defining the database tables

Within the world of Python MVC web frameworks, the database tables are the models. Used by the website to store data, they are generated with and modeled by Python classes. These classes subclass or inherit pre-written functionality from a superclass that contains a majority of the database management code, leaving us to simply define the columns of the table using basic data types such as strings and integers, as well as advanced classes such as geometries.

These class-defined tables can be generated in multiple RDBMS without the need to revamp how the model code is written. While GeoAlchemy2 only works on top of PostgreSQL/PostGIS, SQLAlchemy models can be used to generate tables in a variety of databases, including ...

Get Mastering Geospatial Analysis with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.