Next / Previous / Contents / NM Tech homepage

6.5. The nations table

This table defines the nation codes used in Section 6.6, “The regions table”. The script used to load (or reload) this table is shown in Section 7, “The staticloader script: Populate the static tables”.

Next we create an instance of the MetaData class to hold all the schema definitions.
# Table declarations
    meta = schema.MetaData()

    nations_table = schema.Table('nations', meta,
        schema.Column('nation_code', types.CHAR(3), primary_key=True),
        schema.Column('nation_name', types.VARCHAR(30)))

    class Nation(object):
        '''Class within a class: mapped class for the nations table.
        def __init__(self, nation_code, nation_name):
            self.nation_code = nation_code
            self.nation_name = nation_name
        def __repr__(self):
            return ( "<Nation(%s: %s)>" %
                     (self.nation_code, self.nation_name) )