How to use Combine to prepare batches for write into InfluxDB
- macOS 11+
- Cloned examples:
git clone [email protected]:influxdata/influxdb-client-swift.git cd Examples/WriteDataInBatches
- Start InfluxDB:
docker run --rm \ --name influxdb_v2 \ --detach \ --publish 8086:8086 \ influxdb:latest
- Configure your username, password, organization, bucket and token:
docker run --rm \ --link influxdb_v2 \ curlimages/curl -s -i -X POST http://influxdb_v2:8086/api/v2/setup \ -H 'accept: application/json' \ -d '{"username": "my-user", "password": "my-password", "org": "my-org", "bucket": "my-bucket", "token": "my-token"}'
- Write data by:
swift run write-data-in-batches --bucket my-bucket --org my-org --token my-token --url http://localhost:8086
Writing 500 items ...
> success
Writing 500 items ...
> success
Writing 500 items ...
> success
Writing 500 items ...
> success
Writing 500 items ...
> success
Writing 500 items ...
> success
Writing 500 items ...
> success
Writing 452 items ...
> success
Import finished!