File: data.load

package info (click to toggle)
pgloader 3.6.10-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,060 kB
  • sloc: sql: 32,321; lisp: 14,793; makefile: 435; sh: 85; python: 26
file content (68 lines) | stat: -rw-r--r-- 1,349 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--
-- Ads
--
load csv
  from ads.csv
  (
    id, company_id, campaign_id, name, image_url, target_url,
    impressions_count, clicks_count, created_at, updated_at
  )
  
  into postgresql:///hackathon
  
  target table ads
  target columns
  (
    id, campaign_id, name, image_url, target_url,
    impressions_count, clicks_count, created_at, updated_at
  )

  with fields optionally enclosed by '"',
       fields escaped by double-quote,
       fields terminated by ',';

--
-- Clicks
--
load csv
  from clicks.csv
  (
   id, company_id, ad_id, clicked_at, site_url, cost_per_click_usd, 
   user_ip, user_data
  )
  
  into postgresql:///hackathon
  
  target table clicks
  target columns
  (
   id, ad_id, clicked_at, site_url, cost_per_click_usd, user_ip, user_data
  )

  with fields optionally enclosed by '"',
       fields escaped by double-quote,
       fields terminated by ',';


--
-- Impressions
--
load csv
  from impressions.csv
  (
    id, company_id, ad_id, seen_at, site_url,
    cost_per_impression_usd, user_ip, user_data
  )
  
  into postgresql:///hackathon
  
  target table impressions
  target columns
  (
    id, ad_id, seen_at, site_url, cost_per_impression_usd, user_ip, user_data
  )

  with drop indexes,
       fields optionally enclosed by '"',
       fields escaped by double-quote,
       fields terminated by ',';