Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IO: Add the if-exists query parameter by updating to influxio 0.4.0 #176

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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