# ClickHouse

> Insert, update, and delete rows in your ClickHouse database tables.

App · Databases · 3 actions. Web page: https://docs.lodol.com/docs/integrations/clickhouse

## Actions

### Delete rows

Remove the rows that match a filter. Provide the column/value conditions that pick which rows to delete. A non-empty filter is required so you never delete every row by accident.

**Inputs**

- Database (`database`, text): The database that contains the table. Pick one, or leave blank to use the connection's default database.
- Table (`table`, text, required): The table to act on. Pick a table, or type its name (for example 'events'). Choose a database first to load its tables.
- Match rows where (`filter`, object, required): Which rows to delete, as column/value pairs (for example, id: 42). A row is deleted only when it equals every value given (combined with AND). Must be non-empty; deleting every row is not allowed.

**Outputs**

- `database` (text): Database of the table (null when the default was used)
- `matched_by` (list): Filter columns used to select rows
- `status` (text): 'applied' once ClickHouse has run the delete
- `table` (text): Table rows were deleted from

**Example output**

```json
{
  "database": "default",
  "matched_by": [
    "id"
  ],
  "status": "applied",
  "table": "events"
}
```

### Insert rows

Add one or more rows to a table. Each row is given as column/value pairs; columns you omit fall back to their defaults, so you only provide the columns you have values for.

**Inputs**

- Database (`database`, text): The database that contains the table. Pick one, or leave blank to use the connection's default database.
- Table (`table`, text, required): The table to act on. Pick a table, or type its name (for example 'events'). Choose a database first to load its tables.
- Rows (`rows`, list, required): The rows to insert, as a list of objects. Each object maps column names to values, for example [{"id": 1, "name": "Ada"}, {"id": 2, "name": "Grace"}].

**Outputs**

- `database` (text): Database written to (null when the default was used)
- `inserted_rows` (number): Number of rows sent to ClickHouse
- `table` (text): Table written to

**Example output**

```json
{
  "database": "default",
  "inserted_rows": 2,
  "table": "events"
}
```

### Update rows

Change column values on the rows that match a filter. Provide the new values to set and the column/value conditions that pick which rows to update. A non-empty filter is required so you never update every row by accident.

**Inputs**

- Database (`database`, text): The database that contains the table. Pick one, or leave blank to use the connection's default database.
- Table (`table`, text, required): The table to act on. Pick a table, or type its name (for example 'events'). Choose a database first to load its tables.
- Set values (`assignments`, object, required): The columns to change and their new values, as column/value pairs (for example, status: "archived", score: 10).
- Match rows where (`filter`, object, required): Which rows to update, as column/value pairs (for example, id: 42). A row is updated only when it equals every value given (combined with AND). Must be non-empty; updating every row is not allowed.

**Outputs**

- `database` (text): Database of the updated table (null when the default was used)
- `matched_by` (list): Filter columns used to select rows
- `status` (text): 'applied' once ClickHouse has run the update
- `table` (text): Table that was updated
- `updated_columns` (list): Columns whose values were set

**Example output**

```json
{
  "database": "default",
  "matched_by": [
    "id"
  ],
  "status": "applied",
  "table": "events",
  "updated_columns": [
    "status"
  ]
}
```
