Features
Watch a database
Capture new and updated rows from your database tables as memories.
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.
Watch a database when...
- The facts you want to remember are written to tables by several services.
- Changing every service to call
captureisn't practical.
Availability
| SDK | Available |
|---|---|
| Python | Yes |
| TypeScript | No. Call capture where rows are written, or use instrument. |
Set it up
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
| 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. |
Use a read-only database user, and read the connection string from the environment. Watch only tables whose rows are safe to remember.
Next steps
Your tables are watched. Capture events from outside tools next.