Note: The samples in this section use Coastal Risk (Distance to Coast) as an example. All products are uploaded using the same steps. Related scripts for each product are found in the Prerequisites section.
- Download the product delivery file.
- Extract the delivery file to find the text data file.
- Create the table structure in the database using the Create Table script. Be sure to change the table name in the template to the name of the dataset you are loading. If, for example, you are loading the data for Coastal Risk (Distance to Coast), the table should be named dist_to_coast.
- Once the table structure has been created, copy data using the PostgreSQL Copy command:
copy <table_name> from '<path_to_text_file>\<text_file_name.txt>'
delimiter '|' csv quote e'\b';
Syntax:
<table_name>
: Name of the table created using the Create Table
script
<path_to_text_file>
: Path to extracted data text file
<text_file_name.txt>
: Extracted data text file name including
extension
delimiter
: Defines the text delimiter (in this case, the pipe
character)
csv quote e’/b’
: Specifies quoting
Example – Linux:
copy from '/mnr/Distance_to_Coast/Distance_to_Coast_Data/Distance_to_Coast.txt'
delimiter '|' csv quote e'\b'
Example – Windows:
copy from 'F:\Distance_to_Coast\Distance_to_Coast_Data\Distance_to_Coast.txt'
delimiter '|' csv quote e '\b'