robconery.com

Importing a CSV Into PostgreSQL Like a Pro

2 years ago | Postgres Videos
Importing data into PostgreSQL can be time consuming and painful – unless you toss the GUI tools and use scripts.
***

USING HEAD

It all starts with using the head command in the shell in order to pull out the column names:

head -1 master_plan.csv

This will pop out the very first line of the CSV, which is typically the header row. I’m working with Cassini’s mission plan data, so this is what I see:

Now I just copy/paste that into VS Code and run a simple replacement using “Change all Occurrences” to build my create table statement.

The final step is to use the copy from command to pull data out of the CSV and into the database. There’s a whole lot more to this (like data types to use and creating an isolated schema) – just watch the video already!

Learn Postgres Using Data from NASA's Cassini Mission

I wrote a fun database tutorial using data from NASA's Cassini Mission. You get to load up your database with actual data from Saturn: A Curious Moon

  • Real data from Cassini
  • Search for traces of alien life (really)

There's More...

The Subtle Arts of Logging and Testing

I'm a big fan of testing, but I get lazy sometimes and it ends up costing me money, directly.

Test-driven Development In Action

TDD is one of those things that people talk about, argue about, and think is interesting. I'm one of those people, so I asked Brad Wilson to clear it all up for me.

Meet Playwright

Curious about Playwright, the frontend testing framework? Well hang out for the next hour and I'll show it to you!