How fakebaconpancakes/instacart-sql-analysis works
Instacart E-Commerce Analytics turns order-history data into retention, merchandising, and fulfillment insights. Its workflow prepares local data, publishes it to MotherDuck, then serves SQL analyses and interactive dashboard results. The graph includes the documented analysis areas; source excerpts confirm the connection helpers and several dashboard interactions, but not every query implementation or dashboard section.
Main entry points: database.py Connection and SQL Helpers · app.py Executive Dashboard · upload_to_motherduck.py MotherDuck Publisher · db_setup.py CSV-to-SQLite ETL
Components 15
Data Preparation
- CSV-to-SQLite ETL
db_setup.py - Local SQLite
- MotherDuck Publisher
upload_to_motherduck.py - MotherDuck Database
Business Analytics
- Customer Segmentation
queries/customer_segmentation.sql - Top Products
queries/top_products.sql - Product Pairs
queries/product_pairs.sql - Product Affinity
queries/product_affinity.sql - Hourly Demand
queries/hourly_demand.sql - Daily Demand
queries/daily_demand.sql
Dashboard Delivery
- Executive Dashboard
app.py - Connection and SQL Helpers
src/database.py - Tables and Charts
app.py
Other components
- Instacart CSVs
- Dashboard User
Connections 14
- Instacart CSVs → CSV-to-SQLite ETL: supplies CSVs
- CSV-to-SQLite ETL → Local SQLite: loads tables
- MotherDuck Publisher → Local SQLite: reads tables
- MotherDuck Publisher → MotherDuck Database: uploads tables
- Dashboard User → Executive Dashboard: uses dashboard
- Executive Dashboard → Connection and SQL Helpers: requests SQL and queries
- Connection and SQL Helpers → MotherDuck Database: runs SQL
- Connection and SQL Helpers → Customer Segmentation: reads SQL
- Connection and SQL Helpers → Top Products: reads SQL
- Connection and SQL Helpers → Product Pairs: reads SQL
- Connection and SQL Helpers → Product Affinity: reads SQL
- Connection and SQL Helpers → Hourly Demand: reads SQL
- Connection and SQL Helpers → Daily Demand: reads SQL
- Executive Dashboard → Tables and Charts: renders results