Skip to content

Instantly share code, notes, and snippets.

Last active December 16, 2015 01:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
--create a table to store the data
create table script_ferris_bueller
tag_type varchar,
speaker varchar,
line text,
line_begin int,
line_end int,
movie_name varchar
--upload the data
\COPY script_ferris_bueller FROM 'ferris_buellers_day_off.txt' CSV HEADER
--more explicit but useful if your columns aren't in order
\COPY script_ferris_bueller(tag_type,speaker,line,line_begin,line_end,movie_name)
FROM 'ferris_buellers_day_off.txt' CSV HEADER
--turn on extended display
--take a peak at the data
select * from script_ferris_bueller order by random() limit 1;
---[ RECORD 1 ]-----------------------------------
--tag_type | dialogue
--speaker | FERRIS
--line | This is optomism. It's a common
-- | trait with my age group. Adults
-- | think it's cute, it's like a charming
-- | quick that infests youth. But it's
-- | a cool thing and I think, deep down,
-- | crusty old shits wish they had some.
-- | They wish they had her, too.
-- | (points to Sloane)
-- | Sorry. She's taken.
--line_begin | 2188
--line_end | 2197
--movie_name | ferris_bueller's_day_off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment