Skip to content

Instantly share code, notes, and snippets.

@soandos
soandos / gist:498839b0dda70d99a665
Created June 18, 2014 14:14
Current Campaigns' info
SELECT merger.nid,
Group_concat(categories SEPARATOR '') AS categories,
Group_concat(types SEPARATOR '') AS types,
merger.created,
mapping.alias AS name
FROM ((SELECT ti.nid,
ti.tid,
ti.created,
Group_concat(td.name SEPARATOR '|') AS categories,
'' AS types
import requests
req = {'limit' : 100,
'start_time': '2012-06-12T010:30-5:00',
'include_profile' : 'false',
'end_time': '2014-06-13T10:30-5:00',
'page': PAGE_NUM}
r=requests.get(r'https://secure.mcommons.com/api/messages',auth=('USERNAME','PASSWORD'),data=req)
print r.text
from pymongo import MongoClient
from datetime import datetime
import requests
from bs4 import BeautifulSoup
import time
messages = {}
client = MongoClient()
db = client.test1
coll = db.testData
start = time.time()
#explain extended
select
mc.phone_number,
mc.email,
mc.first_name,
mc.last_name,
mc.geocoded_postal_code,
mc.city,
mc.all_campaigns,
mc.first_campaign,
@soandos
soandos / gist:b7cb0a97d38ef4b20298
Created June 6, 2014 15:30
Get true referral count
select
substring(source_name, 1, 14) as sourceNum,
count(*) as Number
from
data.mcomm
where
source_type = 'Tell A Friend'
group by substring(source_name, 1, 14)
having count(*) > 1
order by count(*);