kndndrj / nvim-dbee

Interactive database client for neovim
GNU General Public License v3.0
617 stars 40 forks source link

Fix: `ResultStream` iterator throws error when BigQuery iterator returns `iterator.Done` #70

Closed ashish10alex closed 6 months ago

ashish10alex commented 6 months ago

This pull request:

BigQuery iterator when has no items left, throws iterator.Done which when handled appropriately solves this issue. Please see screenshot attached.

Please let me know if this is not the right way to fix this as I had not written any Go before, but it works :)

Testing

CleanShot 2024-01-13 at 12 44 23@2x

kndndrj commented 6 months ago

Hey, Thanks for both contributions. I'll just comment here for both of them:

The other pr (#71) looks good and I agree it's very helpful.

As for this one, the fix is not "right", but you showed me exactly where the issue is. I'm just in the process of adding tests for all adapters, so I'll fix this there. Meanwhile users of bigquery (#67) can use your branch.

One more thing, do you happen to know if there is an easy way to run bigquery in docker or to mock it locally?

Thanks :)

ashish10alex commented 6 months ago

Hi @kndndrj , Thanks for merging the other https://github.com/kndndrj/nvim-dbee/pull/71 . Looking forward to the correct solution on this one.

Regarding the BigQuery emulator: I found this GitHub page and could make it work.

Steps I followed ->

  1. Download emulator cli from their releases

  2. Download this yaml that will create/emulate project / dataset / table for you.

  3. Run the BigQuery emulator

    ./bigquery-emulator --project=test --data-from-yaml=data.yaml
  4. Then I hack the bigquery Client instantiation as shown to make it work as I could not figure out how to pass the options for these in the plugin config directly. Please let me know if/how that is possible.

    bqc, err := bigquery.NewClient(
                    ctx,
                    u.Host,
                    option.WithEndpoint("http://0.0.0.0:9050"),
                    option.WithoutAuthentication(),
        )
  1. Use your awesome plugin to connect to it :)
ashish10alex commented 6 months ago

Moved the temporary fix to this separate branch in the forked repository as I messed by my original fork by making changes in the main branch !