Skip to content

Instantly share code, notes, and snippets.

@rajiteh
Created December 12, 2014 04:50
Show Gist options
  • Save rajiteh/f204538506bca973fc1f to your computer and use it in GitHub Desktop.
Save rajiteh/f204538506bca973fc1f to your computer and use it in GitHub Desktop.
Postgres way of doing mysql insert ignore
INSERT INTO ew_events (
id,
name,
CONTENT,
url,
img,
LOCATION,
lat,
lng,
date_start,
date_end,
tz_offset,
date_created,
date_modified )
(
SELECT
*
FROM (
VALUES (
1,
'Hacks/Hackers Toronto Pub Night series',
'{"description":"Update [masked]):\n\nHi everyone, your HHTO organizers have been in touch with those at ONA (Online News Association) and CAJ (Canadian Association of Journalists), and together, we have decided to host a joint pub night this month. Please note the change of date and location for the event.\n\nThere''s been talk OF including a recap OF the recent chicago ona conference, but the details have yet TO be settled. CHECK the ona meetup\u00a0listing next week OR so FOR more details.\n\nuntil THEN.\n\nleon &the hacks\/hackers toronto team\n\n\n\nCome out for a drink up with others who are interested in, are working with, and\/or are affected by the ways new media is changing the creation, dissemination, presentation and business of journalism.\n\nYou might learn something new, have a disagreement, find what you know is a big help to someone, get an idea, make a new friend, have a nice time, or have one too many.\n\nAll are welcome: hacks and hackers, data journalists and scientists, open data and gov aficionados, students and academics, beginners and pros, venture capitalists and paupers, teetotallers and barflies. Bring your colleagues, and feel free to cross post this invitation with any group that could be relevant to the conversation.\n\n#HHTO\n\nSee you there,\n\nLeon & the Hacks\/Hackers Toronto Team","group":"Hacks\/Hackers Toronto"}',
'http://www.meetup.com/Hacks-Hackers-Toronto/events/212228762/',
'http://graph.facebook.com/Meetup/picture?type=square',
'{"location":"Firkin on King"}',
43.645077,
- 79.396378,
timestamp '2014-11-27 18:00:00',
timestamp '2014-11-27 21:00:00',
'',
timestamp '2014-10-15 11:24:03',
timestamp '2014-11-25 10:35:03' ),
(
2,
'Home for the Holidays Fundraising Concert',
'{"description":"Come kick off the holiday season on December 1st and help transform the lives of our community\u2019s most vulnerable seniors, adults and youth. Join LOFT Community Services for the 24th annual Home for the Holidays fundraising concert. Performances will span the musical spectrum from Broadway tunes to sing-along Christmas Carols in the beautiful St. James Cathedral.\n\nCharitable Registration Number: 13058 6605 RR0001\n\nVisit our website or call listed phone number for more details.","categories":["Live performances","Music","Charity\/Cause"],"presented_by_org_name":"LOFT Community Services","org_contact_phone":"416-979-1994","org_contact_ext":"222","ttc":"NW corner of Church and King. Take subway to King and walk east to next major intersection (3 blocks) or take streetcar 2 stops east to Church St.","event_url":"http:\/\/www.loftcs.org\/events","org_contact_e_mail":"apaterson@loftcs.org","accessible_fully":"Fully accessible","public_washrooms":"Public washrooms","performance":"Performance","history":"National historic site","reservations":"Reservations required"}',
'http://wx.toronto.ca/festevents.nsf/cureventsall/ADCBB48C9197954085257D91007085ED?OpenDocument',
'http://wx.toronto.ca/festevents.nsf/all/ADCBB48C9197954085257D91007085ED/$File/LOFT Logo - cmyk.jpg',
'{"location":"St. James Cathedral","intersection":"Church Street and King Street East","area":"Downtown"}',
43.6502834961,
- 79.3743564285,
timestamp '2014-12-01 19:00:00',
timestamp '2014-12-01 21:30:00',
'',
timestamp '2014-11-18 19:38:12',
timestamp '2014-11-26 00:02:37' ) ) AS tmp (
id,
name,
CONTENT,
url,
img,
LOCATION,
lat,
lng,
date_start,
date_end,
tz_offset,
date_created,
date_modified )
WHERE
NOT EXISTS (
SELECT
DISTINCT 1
FROM
ew_events
WHERE
id = tmp.id ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment