Skip to content

Commit

Permalink
IO: Add the if-exists query parameter by updating to influxio 0.4.0
Browse files Browse the repository at this point in the history
Co-authored-by: Niklas Schmidtmer <[email protected]>
  • Loading branch information
amotl and hammerhead committed Jun 24, 2024
1 parent 783313a commit 4797dda
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


## Unreleased
- IO: Added the `if-exists` query parameter by updating to influxio 0.4.0.

## 2024/06/18 v0.0.14
- Add `ctk cfr` and `ctk wtf` diagnostics programs
Expand Down
23 changes: 22 additions & 1 deletion doc/io/influxdb/loader.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ working with InfluxDB.
pip install --upgrade 'cratedb-toolkit[influxdb]'
```

## Examples
## Usage

### Workstation

Expand Down Expand Up @@ -66,5 +66,26 @@ ctk load table \
--cratedb-sqlalchemy-url="crate://admin:[email protected]:4200/testdrive/demo?ssl=true"
```

## Parameters

### `if-exists`

The target table will be created automatically, if it does not exist. If it
does exist, the `if-exists` URL query parameter can be used to configure this
behavior. The default value is `fail`, the possible values are:

* `fail`: Raise a ValueError.
* `replace`: Drop the table before inserting new values.
* `append`: Insert new values to the existing table.

:::{rubric} Example usage
:::
In order to always replace the target table, i.e. to drop and re-create it
prior to inserting data, use `?if-exists=replace`.
```shell
export CRATEDB_SQLALCHEMY_URL="crate://crate@localhost:4200/testdrive/demo?if-exists=replace"
ctk load table influxdb2://example:token@localhost:8086/testdrive/demo
```


[influxio]: inv:influxio:*:label#index
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ full = [
]
influxdb = [
"cratedb-toolkit[io]",
"influxio>=0.3.1,<1",
"influxio>=0.4,<1",
]
io = [
"cr8",
Expand Down

0 comments on commit 4797dda

Please sign in to comment.