# Watch a database (/docs/memory/automatic-capture/watch)
Much of what your app knows lands in its database first: orders, tickets, account changes. `watch` checks the tables you choose on a schedule and captures new and updated rows.

<Callout type="info" title="Watch a database when...">
- The facts you want to remember are written to tables by several services.
- Changing every service to call `capture` isn't practical.
</Callout>

## Availability [#availability]

| SDK | Available |
| --- | --- |
| Python | Yes |
| TypeScript | No. Call `capture` where rows are written, or use `instrument`. |

## Set it up [#set-it-up]

```python
import os
from docklee import Dock

dock = Dock()
dock.watch(
    connection_string=os.environ["ORDERS_DATABASE_URL"],
    tables=["orders", "support_tickets"],
    poll_interval=10,
)
```

`watch` runs in a background thread, so the call returns at once and your app keeps running.

## Options [#options]

| Option | Default | Description |
| --- | --- | --- |
| `connection_string` | none | How to connect to the database. |
| `tables` | none | The tables to watch. |
| `poll_interval` | `5` | Seconds between checks. |
| `capture_inserts` | `True` | Capture new rows. |
| `capture_updates` | `True` | Capture changed rows. |

<Callout type="warn">
Use a read-only database user, and read the connection string from the environment. Watch only tables whose rows are safe to remember.
</Callout>

## Next steps [#next-steps]

Your tables are watched. Capture events from outside tools next.

<Cards>
  <Card title="Listen for webhooks" href="/docs/memory/automatic-capture/listen" description="Capture events from the tools you use." />
  <Card title="Instrument your app" href="/docs/memory/automatic-capture/instrument" description="Capture write requests." />
  <Card title="Duplicates" href="/docs/memory/essentials/duplicates" description="How repeated rows are handled." />
</Cards>
