# `Beancount.Schemas.Query`
[🔗](https://github.com/thanos/beancount_ex/blob/v0.6.0/lib/beancount/schemas/directives.ex#L563)

Persisted `query` directive (table `beancount_queries`).

Storage-layer counterpart of `Beancount.Directives.Query`.

## Fields

  * `date` - the day the named query is associated with.
  * `name` - query name, e.g. `"monthly-expenses"`.
  * `bql` - the BQL query string.
  * `metadata` - arbitrary key/value map.
  * `file_order` - zero-based position of the directive in the source.

## Example

    %Beancount.Schemas.Query{
      date: ~D[2026-01-08],
      name: "recent",
      bql: "SELECT date, account, position",
      metadata: %{},
      file_order: 15
    }

# `t`

```elixir
@type t() :: %Beancount.Schemas.Query{
  __meta__: term(),
  bql: term(),
  date: term(),
  file_order: term(),
  id: term(),
  inserted_at: term(),
  metadata: term(),
  name: term(),
  updated_at: term()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
