Skip to content

Instantly share code, notes, and snippets.

+----------------+---------------+
| Country | TotalOrders |
|----------------+---------------|
| United States | 4762 |
| India | 3304 |
| China | 3242 |
| United Kingdom | 1610 |
| Canada | 1524 |
+----------------+---------------+
Time: 0.395s
SELECT Country, COUNT(DISTINCT InvoiceNo) as TotalOrders
FROM "orders"
GROUP BY Country
ORDER By TotalOrders DESC;
+------------------------------------+------------------+
| Description | QuantitiesSold |
|------------------------------------+------------------|
| ASSORTED COLOUR BIRD ORNAMENT | 87786 |
| WHITE METAL LANTERN | 65821 |
| WHITE HANGING HEART T-LIGHT HOLDER | 65319 |
| CREAM CUPID HEARTS COAT HANGER | 43978 |
| RED WOOLLY HOTTIE WHITE HEART. | 43260 |
+------------------------------------+------------------+
Time: 0.423s
SELECT *
FROM orders
LIMIT 10;
SELECT Description, SUM(Quantity) as QuantitiesSold
FROM "orders"
GROUP BY Description
ORDER By QuantitiesSold DESC
LIMIT 5;
{
"InvoiceNo": 14,
"InvoiceDate": 1547523082,
"CustomerID": 10140,
"Country": "India",
"StockCode": 3009,
"Description": "HAND WARMER RED POLKA DOT",
"Quantity": 6,
"UnitPrice": 1.85
}
rock configure --api_key <YOUR-API-KEY>
# Kafka Configuration
KAFKA_TOPIC = 'orders'
KAFKA_BOOTSTRAP_SERVER = ['localhost:9092']
# Rockset Configuration
ROCKSET_API_KEY = '' # Create API Key - https://console.rockset.com/manage/apikeys
ROCKSET_API_SERVER = 'https://api.rs2.usw2.rockset.com'
python3 -m virtualenv rockset-kafka-demo
source rockset-kafka-demo/bin/activate
pip install -r requirements.txt
git clone git@github.com:rockset/recipes.git
cd recipes/kafka-rockset-integration/