This page explains all the pieces required in order to implement an application that uses the Odyssey framework.
Each application has a project directory rooted at svn+ssh://odyssey@core.cs/u/odyssey/svn/odyssey/trunk/project/[application]
.
This directory is for any miscellaneous files related to development such a shell script for invoking the application and test scripts. Additionally, there is a relative symlink to the Python code and one to the SQL schema for the application.
The Python code for each application follows typical Python packaging conventions. Typical subdirectories may include:
The whole directory is maintained in Subversion at svn+ssh://odyssey@core.cs/u/odyssey/svn/odyssey/trunk/python/uw/local/[application]
. This means that applications can access each others’ code by importing the appropriate Python module named uw.local.[application].…
.
The SQL schema definition for an application is broken up into a number of files. There is always an init.sql
file; executing this file as the appropriate Postgres user will create the schema corresponding to the application and assign appropriate role permissions, all within a transaction. Normally, there will be a one-to-one correspondence between applications and Postgres schemas. Regardless, the schema definitions are organized by Postgres schema.
The init.sql
file in turn includes init_data.sql
, init_view.sql
, and init_perm.sql
. These are responsible for creating all objects in the schema:
init_data.sql
— Creates all tables (and sequences). In particular, the objects created here are the ones which, if dropped and re-created, will have lost something (in particular, the data stored in the tables; current value of sequences). Typically this simply includes a number of files of the form [section]_data.sql
.
init_view.sql
— Creates all non-data-holding schema objects, including views and functions. The important distinction here is that these objects can be dropped and re-created in a working database without losing anything. Typically this simply includes a number of files of the form [section]_view.sql
.
init_perm.sql
— Assigns all role permissions. Does not create the roles themselves; that is done manually.
The SQL schema is maintained in Subversion at svn+ssh://odyssey@core.cs/u/odyssey/svn/odyssey/trunk/sql/[schema]
, where [schema]
is the Postgres schema name.
-- IsaacMorland - 05 Nov 2008