This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM search_logs | |
WHERE keyword = ‘rockset’ | |
AND locale = ‘en’ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT keyword, count(*) c | |
FROM search_logs | |
GROUP BY keyword | |
ORDER BY c DESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Accepts POST requests at the /webhook endpoint | |
app.post('/webhook', (req, res) => { let body = req.body; if | |
(body.object === 'page') { body.entry.forEach(function(entry) { let | |
event = entry.messaging[0]; if (event.message && event.message.text) | |
{ // handle the message handleMessage(event); } }); // Return a '200 | |
OK' response res.status(200).send('EVENT_RECEIVED'); } else { // | |
Return a '404 Not Found' res.sendStatus(404); } }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Accepts POST requests at the /webhook endpoint | |
app.post('/webhook', (req, res) => { let body = req.body; if | |
(body.object === 'page') { body.entry.forEach(function(entry) { let | |
event = entry.messaging[0]; if (event.message && event.message.text) | |
{ // handle the message handleMessage(event); } }); // Return a '200 | |
OK' response res.status(200).send('EVENT_RECEIVED'); } else { // | |
Return a '404 Not Found' res.sendStatus(404); } }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Accepts POST requests at the /webhook endpoint | |
app.post('/webhook', (req, res) => { | |
let body = req.body; | |
if (body.object === 'page') { | |
body.entry.forEach(function(entry) { | |
let event = entry.messaging[0]; | |
if (event.message && event.message.text) { | |
// handle the message | |
handleMessage(event); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with listings as ( | |
select id, name, price, property_type | |
from airbnb_listings | |
where lower(airbnb_listings.city) like :city | |
and airbnb_listings.accommodates::int >= :number | |
order by airbnb_listings.number_of_reviews desc | |
) | |
select listings.id, listings.name, listings.property_type, listings.price | |
from listings, airbnb_calendar | |
where airbnb_calendar.date = :date and airbnb_calendar.available = :avail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select summary from airbnb_listings where id = :listing_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select comments, date | |
from airbnb_reviews | |
where listing_id = :listing_id | |
order by date desc | |
limit 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = async (event, context) => { | |
for (const record of event.Records) { | |
let platform = record.dynamodb['NewImage']['platform']['S']; | |
let amount = record.dynamodb['NewImage']['amount']['N']; | |
let data = ... // format according to your Redshift schema | |
var params = { | |
Data: data | |
StreamName: 'test' | |
PartitionKey: '1234' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from botocore.vendored import requests | |
import os | |
ROCKSET_APIKEY = os.environ.get('ROCKSET_APIKEY') | |
QUERY_TEXT = """ | |
WITH vehicle_incidents AS ( | |
SELECT | |
* | |
FROM |
OlderNewer