Session 8 / 15๐Ÿ”Žืขื‘

The bottom line (TL;DR)

  • Sheets for an MVP, a data store for state, Airtable for a team, Postgres for a system.
  • Data store: key + data structure; Add/replace = upsert.
  • Basic SQL: CREATE, INSERT, SELECT, GROUP BY.
  • Parameters against SQL injection; keys only in a connection.
  • We built a mini-CRM with an API and a pipeline report.

The key points โ€” in depth

1. Choosing a database

By scale, relations, parallel work and who edits.

2. Data stores

Small state between runs, counters, dedupe; a limited quota.

3. Airtable

Linked records, single select, search with a formula, upsert.

4. SQL

Types, constraints, GROUP BY, RETURNING.

5. Supabase/Postgres

The app, Execute a query or REST; parameters.

6. The mini-CRM

A POST/GET API + a daily report.

Concept cards (click or press Enter to flip)

Data store
A small table inside Make with a key.
Key
The unique ID of a record in a data store.
Linked record
A link between records in Airtable.
SQL
A query language for databases.
GROUP BY
Grouping rows for a summary.
SQL injection
Injecting SQL code through input โ€” prevented with parameters.
Supabase
Managed Postgres in the cloud with an API.
Increment function
A rising counter kept between runs.

Spaced repetition โ€” the session concepts

Mark "I knew it" or "Not yet" โ€” the cards you did not know come back more often. Cards from all the sessions are in the arcade.

Quick cheat sheet

WhatDetails
Data store โ†’ Add/replace a recordAn upsert
Data store โ†’ Check the existenceDedupe
Airtable โ†’ Search Records (formula)A search on Airtable's side
PostgreSQL โ†’ Execute a query ($1, $2)SQL with parameters
insert โ€ฆ returning idA new id
select stage, sum(value) โ€ฆ group by stagePipeline
Tools โ†’ Increment functionA counter
interval '14 days'A time range in Postgres

Common mistakes to avoid

  • Concatenating input into SQL.
  • A service_role key in a URL or in text.
  • A data store as a history warehouse.
  • Get a record that stops when there is no record.
  • A single select with a value that doesn't exist.

Self-review questions

  1. When a data store and when Airtable?
  2. How do you prevent SQL injection?
  3. What does GROUP BY do?
  4. Why is RETURNING useful?
  5. How do you prevent a loop in a two-way sync?

Homework and preparing for the next session

  1. An active mini-CRM.
  2. Preparing for session 9: create an API key at OpenAI or Anthropic (or make sure you have access to the Make AI Provider). A Gmail account with 10 sample emails.