Skip to content

Instantly share code, notes, and snippets.

View pcothenet's full-sized avatar
🌋
We're hiring!

Paul Cothenet pcothenet

🌋
We're hiring!
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/normalize.css">
</head>
<body>
</body>
@pcothenet
pcothenet / schema.md
Last active August 29, 2015 14:22
List all tables in MadKudu SQL
SELECT DISTINCT schemaname, tablename FROM pg_table_def;
SELECT schemaname, tablename, "column", "type"
FROM pg_table_def
WHERE tablename = 'TABLE_NAME';
SELECT
		e.event_id,
		e.event_timestamp,
		e.event,
		c.contact_id,
		c.email
FROM 
 events AS e
@pcothenet
pcothenet / events_to_contacts.sql
Last active August 29, 2015 14:23
events_to_contacts
SELECT
*
FROM
events AS e
INNER JOIN
contacts AS c
ON e.contact_id = c.contact_id
LIMIT 1000;
@pcothenet
pcothenet / madkudu-segment.md
Last active August 29, 2015 14:24
madkudu-segment

Getting Started

Once you've installed Segment in your app, turn on MadKudu from the Segment integrations page. Get your API Key from Settings > API Key in MadKudu and add it to segment.

MadKudu supports the identify, track, page and group methods.


Identify

@pcothenet
pcothenet / account_firmographics.md
Created August 6, 2015 16:21
account_firmographics
SELECT 
  c.contact_id,
  c.email,
  af.*
FROM 
  contacts AS c
INNER JOIN 
  contacts_to_accounts AS c2a
ON c.contact_id = c2a.contact_id
@pcothenet
pcothenet / s3_put_object.md
Last active October 20, 2015 18:21
s3api put-object
aws s3api put-object --bucket madkudu-data-in-XXXX --key destination_file_name.csv --body ./Documents/file_to_upload.csv
@pcothenet
pcothenet / s3_put_object_identify.md
Last active October 20, 2015 18:21
s3 put-object identify
aws s3api put-object --bucket madkudu-data-in-XXXX --key identify/contact_file_name.csv --body ./Documents/contacts.csv
UNLOAD ("SELECT contact_key, email, attribute_1, attribute_2 FROM [your_table]")
TO 's3://madkudu-data-in-[your_org_id]/identify/identify.csv'
CREDENTIALS 'aws_access_key_id=[your_access_key];aws_secret_access_key=[your_secret_key]'
DELIMITER '~'
ADDQUOTES
ESCAPE
MANIFEST
GZIP
ALLOWOVERWRITE