# 4. Data: tables, flows and schedules

## 4.1 Two kinds of data

- **Small data** saved by tools (settings, lists, notes): saved automatically, personal or shared (chapter 5.2).
- **Tables**: datasets from a few rows to a few million, imported from CSV files or made by SQL blocks. Each change makes a new **version**.

## 4.2 Tables

- **Import**: Workshop → **Add** → **Import a file (table)**, or **Import a file** in a flow. Choose a CSV; the separator and the encoding are detected. **Table name**: lowercase letters, digits and `_`, starting with a letter. Importing into an existing table creates a new version of it.
- **Open a table**: two tabs, **Data** (sort, filter, pages of 100 rows) and **Versions** (who made each version, and restore an older one).
- **Export**: CSV or SQLite.
- Size: in LeavenIT's storage, a table version is limited to about 50 MB compressed (several hundred thousand rows). With your own storage (chapter 6), there's no LeavenIT limit, only your device's memory.

## 4.3 Flows and blocks

A **flow** is a set of tables and the **SQL blocks** that turn them into results, shown as a graph.

- **New flow** (Workshop → **Add**). In the flow: **Import a file**, **New block**, **Build all**, **Schedule**.
- **A block** has three tabs:
  - **Inputs**: the tables it reads, each under a short name (alias) used in the script.
  - **Transformations**: the SQL script (SQLite 3.49, see 5.3). It must create the output, by default `create table out as select …`. **Copy context for my AI** copies a description of the inputs (with 3 sample rows if you tick it) and the rules, ready for your AI to write the SQL.
  - **Outputs**: **Published table** (the name of the result) and **Created by the script as** (`out`), plus **Storage**: **Latest version only** (default), **Keep 3 versions**, **Keep 10 versions**, **Temporary** (deleted after 1 to 72 hours, rebuilt when needed).
- **Dry run** runs without publishing; **Run** publishes; **Run with everything after it** runs the blocks that depend on it. A failed block stops the ones after it.

## 4.4 Schedules

A flow's **Schedule** panel:

- **When**: every N minutes, every day at a time, or some days of the week at a time, in your time zone (summer time respected).
- **On**: which device runs it.
  - **This device** (a browser or the installed app): runs **only when LeavenIT is open** on it. A missed time is reported ("LeavenIT wasn't open on the device").
  - **A Runner** ("<name> · Runner, always on"): runs around the clock, even when LeavenIT is closed (chapter 7).
- **Run**: all blocks, or only what changed.
- **Schedules** (left column of Workshop) lists every schedule and every device.

A schedule pauses itself when the flow is changed by someone else, when you lose write access, or when its device is removed. Review it and **resume** it. Notifications tell you when a scheduled run fails, is missed or is paused.
