crate/cratedb-toolkit

[I/O] InfluxDB adapter: CRATEDB_SQLALCHEMY_URL not working when using the Docker-aliased command

amotl opened this issue · 2 comments

Procedure

alias ctk="docker run --rm -it ghcr.io/crate-workbench/cratedb-toolkit:latest ctk"
export CRATEDB_SQLALCHEMY_URL=crate://crate@localhost:4200/testdrive/demo
ctk load table influxdb2://example:token@localhost:8086/testdrive/demo

Problem

KeyError: 'Either CrateDB Cloud Cluster identifier or CrateDB SQLAlchemy or HTTP URL needs to be supplied. Use --cluster-id / --cratedb-sqlalchemy-url / --cratedb-http-url CLI options or CRATEDB_CLOUD_CLUSTER_ID / CRATEDB_SQLALCHEMY_URL / CRATEDB_HTTP_URL environment variables.'

References

Evaluation

Environment variables are not propagated through the command alias, which is a bit bare-bones up until now.

We will need to extend it like (untested):

alias ctk="docker run --rm -it --env="CRATEDB_SQLALCHEMY_URL='${CRATEDB_SQLALCHEMY_URL}'" ghcr.io/crate-workbench/cratedb-toolkit:latest ctk"

Thoughts

In order to enumerate all possible environment variables, the list would quickly grow, and may look unwieldly to handle and use.

Suggestions

  • Improve the documentation, to document only "forwarding" the environment variable CRATEDB_SQLALCHEMY_URL, and otherwise refer the dear reader to the --env-file option of docker run, admitting and educating about that the alias command is only a conveniency shortcut, and may not deliver all available powers of ctk load table without further adjustments.

We decided to not use environment variable configuration together with the Docker command alias operation mode.