# `Ecto.Adapters.ClickHouse`
[🔗](https://github.com/plausible/ecto_ch/blob/v0.11.1/lib/ecto/adapters/clickhouse.ex#L1)

Adapter module for ClickHouse.

It uses `Ch` for communicating to the database.

## Options

All options can be given via the repository
configuration:

    config :your_app, YourApp.Repo,
      ...

  * `:hostname` - Server hostname (default: `"localhost"`)
  * `:username` - Username
  * `:password` - User password
  * `:port` - HTTP Server port (default: `8123`)
  * `:scheme` - HTTP scheme (default: `"http"`)
  * `:database` - the database to connect to (default: `"default"`)
  * `:settings` - Keyword list of connection settings
  * `:transport_opts` - Options to be given to the transport being used. See `Mint.HTTP1.connect/4` for more info

# `delete`

# `to_inline_sql`

```elixir
@spec to_inline_sql(:all | :delete_all | :update_all, Ecto.Queryable.t()) ::
  String.t()
```

Converts the given query to SQL according to its kind and inlines all parameters. Useful for debugging.

Example:

    iex> query = from n in fragment("numbers(10)"), where: n.number == ^-1, select: n.number
    iex> Ecto.Adapters.ClickHouse.to_inline_sql(:all, query)
    ~s{SELECT f0."number" FROM numbers(10) AS f0 WHERE (f0."number" = -1)}

Compare it with the output of `to_sql/2`

    iex> query = from n in fragment("numbers(10)"), where: n.number == ^-1, select: n.number
    iex> Ecto.Adapters.ClickHouse.to_sql(:all, query)
    {~s[SELECT f0."number" FROM numbers(10) AS f0 WHERE (f0."number" = {$0:Int64})], [-1]}

---

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