# ormaos io

> Shows the database, file, subprocess and HTTP events of a recording or a call, grouped by what was done and by the line of your code that caused it.

```text
ormaos io [-h] [--json] [--limit N] [--offset N]
          [--kind {sqlite,file,subprocess,http}]
          [address]
```

| Argument | From the parser | Default |
|---|---|---|
| `address` | `last` (the default), a recording such as r3, or an address inside one: r3:c42 (a call), r3:e5 (an exception), r3:i7 (an io event), r3:l2 (a logging record) | `last` |
| `--json` | print JSON on stdout. |  |
| `--limit N` | show at most N entries (default 20) | `20` |
| `--offset N` | skip the first N entries. |  |
| `--kind KIND` | show only this kind of I/O. One of: sqlite, file, subprocess, http. |  |

```console
$ ormaos io r1:e1
r1:e1 sync_orders and the calls below it: 180 io events (sqlite 180)
  30x sqlite "SELECT on_hand, pack_size FROM stock WHERE sku = ?"  at inventory.py:87 in apply_order  [r1:i3]
  30x sqlite "SELECT ? FROM applied_orders WHERE order_id = ?"  at inventory.py:92 in apply_order  [r1:i4]
  30x sqlite BEGIN  at inventory.py:101 in apply_order  [r1:i5]
  30x sqlite "UPDATE stock SET on_hand = on_hand - ? WHERE sku = ?"  at inventory.py:101 in apply_order  [r1:i6]
  30x sqlite "INSERT INTO applied_orders (order_id, sku, quantity, applied_at) VALU..."  at inventory.py:105 in apply_order  [r1:i7]
  30x sqlite COMMIT  at inventory.py:100 in apply_order  [r1:i8]
calls directly below: 36 check_order (6 raised, no io), 30 apply_order (180 io)
next: ormaos io r1:i3 | ormaos io r1:i4 | ormaos tree r1:c130 | ormaos io r1:c16
```

The I/O is grouped by what was done and by the line of your code that caused it, with a count. A statement, a path or a URL is text of your program, so it is between quotes when it is more than one plain word. The last lines say how the I/O splits among the calls directly below.

| Kind | Recorded | Never recorded |
|---|---|---|
| `sqlite` | the connection (the path of the database), each statement with every literal replaced by `?`, the table | parameters, literals, rows |
| `file` | `open` with the path and the mode; `read` and `write` when Python code calls them on the file | contents, sizes |
| `subprocess` | a program started with `subprocess` or `os.exec*`/`os.posix_spawn`: its name and how many arguments; `os.system` as `system shell`, `os.fork` as `fork` | arguments, environment, output, the shell command |
| `http` | method, scheme, host, port, path, status and duration, for `http.client` (so also `urllib`, `requests`, `urllib3`) and `httpx` | query string, user and password of the URL, `;parameters`, fragment, headers, bodies |

## Arguments

### `address`

A recording, a call (its I/O and the I/O of the calls below it), an exception (the call that handled it), or one I/O event:

```console
$ ormaos io r1:i3
r1:i3 sqlite "SELECT on_hand, pack_size FROM stock WHERE sku = ?"
  caused at   inventory.py:87 in apply_order  [r1:c135]
  inside      r1:c1 <module> > r1:c16 main > r1:c130 sync_orders
  database    data/inventory.db
  parameters  not recorded; literals are shown as ?
next: ormaos io r1:c135 | ormaos tree r1:c135 | ormaos io r1
```

### `--kind KIND`

Only `sqlite`, `file`, `subprocess` or `http`.

```console
$ ormaos io r1 --kind file
r1: 182 io events (sqlite 181, file 1), showing file
  1x file open data/orders.csv (read)  at fetch.py:26 in from_csv  [r1:i2]
next: ormaos io r1:i2 | ormaos io r1:c20 | ormaos exceptions r1
```

### `--limit N`

At most N groups. Default 20.

### `--offset N`

Skips the first N groups.

### `--json`

Kinds `io` and `io_event`. Schemas: [/schemas/io.json](/schemas/io.json), [/schemas/io_event.json](/schemas/io_event.json).

---

Source: https://docs.ormaos.com/python/reference/cli/io/ · ormaos 0.0.1 · ormaos-python 968f69776c · ormaos-examples 6e27be5922
