Loader_Generate_Nation_Script
Prev | 14.2. Tiger Geocoder | Next

## Name

Loader_Generate_Nation_Script — Generates a shell script for the specified platform that loads in the county and state lookup tables.

## Synopsis

`text loader_generate_nation_script(`text os`)`;

## Description

Generates a shell script for the specified platform that loads in the `county_all`, `county_all_lookup`, `state_all` tables into `tiger_data` schema. These inherit respectively from the `county`, `county_lookup`, `state` tables in `tiger` schema.

It uses unzip on Linux (7-zip on Windows by default) and wget to do the downloading. It uses Section 4.7.2, “Using the Shapefile Loader” to load in the data.

It uses the following control tables `tiger.loader_platform`, `tiger.loader_variables`, and `tiger.loader_lookuptables` to control the process and different OS shell syntax variations.

1. `loader_variables` keeps track of various variables such as census site, year, data and staging schemas

2. `loader_platform` profiles of various platforms and where the various executables are located. Comes with windows and linux/unix. More can be added.

3. `loader_lookuptables` each record defines a kind of table (state, county), whether to process records in it and how to load them in. Defines the steps to import data, stage data, add, removes columns, indexes, and constraints for each. Each table is prefixed with the state and inherits from a table in the tiger schema. e.g. creates `tiger_data.ma_faces` which inherits from `tiger.faces`

Enhanced: 2.4.1 zip code 5 tabulation area (zcta5) load step was fixed and when enabled, zcta5 data is loaded as a single table called zcta5_all as part of the nation script load.

Availability: 2.1.0

If you want zip code 5 tabulation area (zcta5) to be included in your nation script load, do the following:
    UPDATE tiger.loader_lookuptables SET load = true WHERE table_name = 'zcta510';

If you were running `tiger_2010` version and you want to reload as state with newer tiger data, you'll need to for the very first load generate and run drop statements Drop_Nation_Tables_Generate_Script before you run this script.

## Examples

Generate script script to load nation data Windows.

    SELECT loader_generate_nation_script('windows');

Generate script to load up data for Linux/Unix systems.

    SELECT loader_generate_nation_script('sh');

## See Also

Loader_Generate_Script, Drop_Nation_Tables_Generate_Script

Prev | Up | Next
Loader_Generate_Script | Home | Missing_Indexes_Generate_Script