Created
April 11, 2016 05:42
-
-
Save tlrobinson/ef32cfbade6fa6392685fcc2c116bede to your computer and use it in GitHub Desktop.
Import Moves app (https://www.moves-app.com/) data export files into PostgreSQL for analysis in Metabase (http://www.metabase.com/). Will need to change the paths to point to the downloaded and extracted CSVs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE activities ( | |
"date" date, | |
"activity" varchar, | |
"group" varchar, | |
"start" timestamp, | |
"end" timestamp, | |
"duration" integer, | |
"distance" real, | |
"steps" integer, | |
"calories" integer | |
); | |
COPY activities ( | |
"date", | |
"activity", | |
"group", | |
"start", | |
"end", | |
"duration", | |
"distance", | |
"steps", | |
"calories" | |
) | |
FROM 'moves_export/csv/full/activities.csv' | |
WITH CSV HEADER; | |
CREATE TABLE places ( | |
"date" date, | |
"name" varchar, | |
"start" timestamp, | |
"end" timestamp, | |
"duration" integer, | |
"latitude" double precision, | |
"longitude" double precision, | |
"category" varchar, | |
"link" varchar | |
); | |
COPY places ( | |
"date", | |
"name", | |
"start", | |
"end", | |
"duration", | |
"latitude", | |
"longitude", | |
"category", | |
"link" | |
) | |
FROM 'moves_export/csv/full/places.csv' | |
WITH CSV HEADER; | |
CREATE TABLE storyline ( | |
"date" date, | |
"type" varchar, | |
"name" varchar, | |
"start" timestamp, | |
"end" timestamp, | |
"duration" integer | |
); | |
COPY storyline ( | |
"date", | |
"type", | |
"name", | |
"start", | |
"end", | |
"duration" | |
) | |
FROM 'moves_export/csv/full/storyline.csv' | |
WITH CSV HEADER; | |
CREATE TABLE summary ( | |
"date" date, | |
"activity" varchar, | |
"group" varchar, | |
"duration" integer, | |
"distance" real, | |
"steps" integer, | |
"calories" integer | |
); | |
COPY summary ( | |
"date", | |
"activity", | |
"group", | |
"duration", | |
"distance", | |
"steps", | |
"calories" | |
) | |
FROM 'moves_export/csv/full/summary.csv' | |
WITH CSV HEADER; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment