cloudspannerecosystem / wrench

wrench - Schema management tool for Cloud Spanner -
MIT License
239 stars 47 forks source link

wrench use environment variables instead of command arguments #70

Open ryoheinagao opened 1 year ago

ryoheinagao commented 1 year ago

Expected Behavior

When specifying project, instance and database by command line args, I want wrench to use the values instead of environment variables.

Current Behavior

wrench use environment variables even if I pass project, instance and database by the command line args.

Steps to Reproduce

$ echo $SPANNER_PROJECT_ID                                                                                                                              
project-local-emulator

$ wrench apply --project my-gcp-project --instance instance1 --database database1 --dml ./sql/dml/000001_init.sql

Error command: apply, version: unknown
        Failed to execute the operation to Cloud Spanner, context deadline exceeded

$ unset SPANNER_PROJECT_ID                                                                                                               
$ echo $SPANNER_PROJECT_ID                                                                                                                              

$ wrench apply --project my-gcp-project --instance instance1 --database database1 --dml ./sql/dml/000001_init.sql
1 rows affected.

Context (Environment)

wrench help says project, instance and database can be specified by command line args. For example, in the description of the arg for database, (optional. if not set, will use $SPANNER_DATABASE_ID value) seems to mean command line args have higher priority than environment variables.