Odyssey 3 Application Structure

This page explains all the pieces required in order to implement an application that uses the Odyssey framework.

Project Directory

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.

Python Code

The Python code for each application follows typical Python packaging conventions. Typical subdirectories may include:

  • db — files containing database interface procedures
  • core — files containing “business rules” or other non-UI-specific implementation
  • webui — files containing web user interface implementation

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].….

SQL Schema Definitions

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

Topic revision: r4 - 2008-11-25 - IsaacMorland
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback