Skip to content

query web --as-table breaks (since 0.92) #12689

Closed

Description

@wdv4758h

Describe the bug

You can't use query web --as-table without --query any more. The command in the examples break.

How to reproduce

Get latest nightly nushell, run the sample command from query web -h, which is http get https://en.wikipedia.org/wiki/List_of_cities_in_India_by_population | query web --as-table [City 'Population(2011)[3]' 'Population(2001)[3][a]' 'State or unionterritory' 'Ref'].

Expected behavior

Can use --as-table without --query

Screenshots

image

Configuration

key value
version 0.92.3
major 0
minor 92
patch 3
branch nightly
commit_hash 24ecb84
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.77.2 (25ef9e3d8 2024-04-09)
rust_channel 1.77.2-x86_64-unknown-linux-gnu
cargo_version cargo 1.77.2 (e52e36006 2024-03-26)
build_time 2024-04-28 01:44:34 +00:00
build_rust_channel release
allocator mimalloc
features dataframe, default, sqlite, static-link-openssl, system-clipboard, trash, which
installed_plugins query

Additional context

No response

Activity

  1. added
    status:needs-triage
    on Apr 28, 2024
  2. wdv4758h commented on Apr 28, 2024

    @wdv4758h
    Author

    Probably this part:

    if let Some(query) = &query {
    if let Err(err) = ScraperSelector::parse(&query.item) {
    return Err(LabeledError::new("CSS query parse error")
    .with_label(err.to_string(), query.span)
    .with_help("cannot parse this query as a valid CSS selector"));
    }
    } else {
    return Err(
    LabeledError::new("Missing query argument").with_label("add --query here", call.head)
    );
    }

    It forces the command to use --query flag, which is not the case in example or previous versions.

  3. wdv4758h commented on Apr 28, 2024

    @wdv4758h
    Author

    I think the bug is also in 0.92. I locked my environment in 0.91, due to errors when upgrading nushell to run my scripts. Finally got time to look into the details.

  4. changed the title [-]query web table parse breaks [/-] [+]query web `--as-table` breaks (since 0.92)[/+] on Apr 28, 2024
  5. fdncred commented on Apr 28, 2024

    @fdncred
    Contributor

    I've fixed this example many times. Typically, what happens is that the Wikipedia page changes slightly so the column names aren't the same anymore. I'm not sure if that's what is going on now, but that's usually what it is.

    I think @devyn changed this code last by rewriting some errors, so something could've been introduced there too?

  6. wdv4758h commented on Apr 28, 2024

    @wdv4758h
    Author

    Nope, it's not related to Wikipedia page. Same command works in nushell 0.91. It's command parsing error since 0.92.

    Wikipedia page is not the root cause for this ticket. But I will suggest maybe use nushell governed web page as example, if that Wikipedia page changes too oftem.

  7. fdncred commented on Apr 28, 2024

    @fdncred
    Contributor

    Yup, I think @devyn broke this by adding the else statement. I just put up a PR to fix it. No biggy. Accidents happen.

  8. fdncred commented on Apr 28, 2024

    @fdncred
    Contributor

    Still works (after #12693). Yay! At least it wasn't Wikipedia this time.
    image

  9. devyn commented on Apr 28, 2024

    @devyn
    Contributor

    Whoops, sorry about that. Guess I didn't read carefully enough. It would be good to add some tests, now that that's easy to do.

  10. added this to the v0.93.0 milestone on Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions