PRQL / prql-query

Query and transform data with PRQL
Apache License 2.0
126 stars 7 forks source link

feat: show PRQL version in about (in `--help` option) #30

Closed eitsupi closed 1 year ago

eitsupi commented 1 year ago

The version of prql-compiler built into this tool may be a bit backward, so informing users of this may help resolve the issue.

I have found that using clap version 4 makes it easy to embed String in help, so I am trying that. So far it is only shown in long_about displayed with --help and the display is simple, but I think I can change it to something better if needed.

-> Updated to show on about without using long_about for now.

$ target/debug/pq -h
pq: query and transform data with PRQL version 0.4.2 (https://prql-lang.org)

Usage: pq [OPTIONS] [QUERY]

Arguments:
  [QUERY]  The PRQL query to be processed if given, otherwise read from stdin [env: PQ_QUERY=] [default: -]

Options:
  -f, --from <FROM>          The file(s) to read data FROM if given [env: PQ_FROM=]
  -t, --to <TO>              The file to write TO if given, otherwise stdout [env: PQ_TO=] [default: -]
  -d, --database <DATABASE>  The database to connect to [env: PQ_DATABASE=]
  -b, --backend <BACKEND>    The backend to use to process the query [env: PQ_BACKEND=] [default: auto] [possible values: auto, datafusion, duckdb]
      --no-exec              Only generate SQL without executing it against files
      --format <FORMAT>      The format to use for the output [env: PQ_FORMAT=] [possible values: csv, json, parquet, table]
  -w, --writer <WRITER>      The Writer to use for writing the output [env: PQ_WRITER=] [default: arrow] [possible values: arrow, backend]
      --sql                  set this to pass a SQL query rather than a PRQL one [env: PQ_SQL=]
  -h, --help                 Print help (see more with '--help')
  -V, --version              Print versio
eitsupi commented 1 year ago

@snth Could you take a look at this? Thanks.

snth commented 1 year ago

Thanks @eitsupi . Looks good. Just one comment about rather keeping that FIXME as a reminder.

eitsupi commented 1 year ago

Thank you for your review. I updated that.

eitsupi commented 1 year ago

@snth Could you take another look at this? Thanks.

snth commented 1 year ago

Hi, apologies for the delay. I finally got to this. It's looking great!

I see the help output has changed quite a lot with the change from clap 3 to 4 but the new formatting is good and more neutral.

I'm happy with the changes. Thanks very much @eitsupi ! I was just wondering if it would be possible to add the same to the short about because as you pointed out, now the PRQL version only shows up with --help and not with -h? If that's not an easy addition then I'm happy to merge as is.

eitsupi commented 1 year ago

@snth Thanks for your review. Updated to show with -h.

This has eliminated any difference in content between -h and --help other than formatting, so for now, long_about is disabled and both -h and --help have the same output.

If the information we want to include only in --help is needed again, we can add long_about again.

eitsupi commented 1 year ago

@snth Is there any reason yet why this cannot be merged? Thanks.

snth commented 1 year ago

No, there isn't and sorry for the holdup. I wanted to test it but I trust that you've done a good job with it.

Compiling things with DuckDB tends to take so long on my machine that I tend to want to batch it along with other tasks such as upgrading the DuckDB and DataFusion versions. I haven't been getting to that part hence I wasn't merging this either.

Happy to merge this now though so that you don't have to worry about it anymore.

Thank you very much for your contribution and apologies again for taking so long on this.

eitsupi commented 1 year ago

Sorry for rushing you. I too suffered from the slow build of duckdb... Definitely worth adding automated tests.