BeginnerAbout 11 min

    Data Schema

    Read the full article on Substack

    6 min read.

    Validate a record live, see the same schema in SQL, JSON Schema, Pydantic, and Protobuf, walk a backward-compatible migration, and use the schema to constrain an LLM's structured output.

    Think of it this way: A schema is the blank form with rules printed on it: this box takes a number, this one a valid email, this one only "admin/user/guest". Fill it wrong and it's rejected at the door.

    Valid. Every field matches the schema.

    integer, required
    string, email format
    integer, at least 0
    one of admin, user, guest

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Fact or dimension?

    Sort

    Sort each table into its place in a star schema.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    Fact table

    Drop items here

    Dimension table

    Drop items here
    6 pieces left to place

    Quiz

    20 questions
    Question 1 of 20
    Score: 0

    What does a schema constraint like CHECK (age >= 0) provide?

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going