Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 3 commits into from

Conversation

ashish10alex
Copy link

@ashish10alex ashish10alex commented Jan 13, 2024

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

  • BigQuery: Is able to fetch results for tables with over 150k rows
  • Other dBs: To make sure other database drivers are not affected by this. I tested the code on a local sqlite dB which worked without any issues.

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

@kndndrj
Copy link
Owner

kndndrj commented Jan 13, 2024

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
Copy link
Author

ashish10alex commented Jan 13, 2024

Hi @kndndrj ,
Thanks for merging the other #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
  1. 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 ashish10alex closed this by deleting the head repository Jan 15, 2024
@ashish10alex
Copy link
Author

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bigquery] Cannot finish fetching results with BigQuery resource
2 participants