Skip to content

Instantly share code, notes, and snippets.

@daniel-sim
Created January 2, 2018 14:19
Show Gist options
  • Save daniel-sim/e68aac05396f66e17e6e33ce5b9106f8 to your computer and use it in GitHub Desktop.
Save daniel-sim/e68aac05396f66e17e6e33ce5b9106f8 to your computer and use it in GitHub Desktop.
LOAD CSV
FROM 'shopify-plug-in-seo-app-history-2018-01-02.csv'
HAVING FIELDS
(
date, event, details, billing_on, shop_name, shop_country, shop_email, shop_domain
)
INTO postgres:///me?app_history
WITH
skip header = 1,
fields terminated by ','
BEFORE LOAD DO
$$ drop table if exists app_history; $$,
$$ create table app_history (
date timestamp,
event text,
details text,
billing_on date,
shop_name text,
shop_country text,
shop_email text,
shop_domain text
);
$$;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment