
How to Load Raw Data Without Breaking Anything
This is a premium course, which you can purchase below.
Our first task is to find the exact dates and times when Cassini flew by Enceladus and made its measurements. We need to create a time window so we can narrow down the results from the INMS - Cassini's on board Ion Neutral Mass Spectrometer - that's the thing that sniffed space for the chemicals we're looking for. Off we go!
When importing data into Postgres from a CSV, it's imperative that you do not try to alter the data - do that by explicitly transforming the data later on.
That means we need to import everything as text
, because that's the core string type in Postgres (as opposed to text
etc).
To create our schema and table:
create schema csvs;
create table csvs.master_plan(
start_time_utc text,
duration text,
date text,
team text,
spass_type text,
target text,
request_name text,
library_definition text,
title text,
description text
);
Copying data from a CSV into our new table:
copy csvs.master_plan
from '[Absolute path to]/csvs/master_plan.csv'
delimiter ',' header csv;