> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encodebox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Database

> Database binds a connector and exposes Sentinel domains as EventFrames.

`Database` is returned by `eb.connect(..., connector=...)`. It binds an engine to a registered Sentinel connector and exposes domains as attributes.

```python theme={null}
import encodebox as eb

eb.register_connector("connectors/postgres_local_sentinel/connector.yml")
db = eb.connect(
    "postgres",
    host="localhost",
    port=5433,
    database="encodebox_sample",
    username="postgres",
    password="postgres",
    connector="postgres_local_sentinel",
)

db.diagnosis   # EventFrame for diagnosis domain
db.procedure
db.medication  # alias of dispensing
db.enrollment
db.demographic
```

## Domain accessors

Each domain starts as an **EventFrame** (Layer 1). Use `.as_table()` to drop to Layer 0 when you need custom column predicates.

```python theme={null}
dx_events = db.diagnosis.matching("E11", code_type="10", match="starts_with")
dx_table = db.diagnosis.as_table()
```

## Connection without a connector

`eb.connect(...)` without `connector=` still returns a SQLAlchemy engine for low-level use. Prefer `connector=` for analytics.

## Related

* [Connectors](/connectors)
* [EventFrame](/api/event-frame)
* [Which API?](/which-api)
