-
Notifications
You must be signed in to change notification settings - Fork 165
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
[CT-1391] [Feature] Add support for BigQuery emulator #358
Comments
@bendiktv2 Thanks for opening! This is cool!! I didn't know about GCP emulators at all. Have you been using this for some time? Any gotchas worth calling out?
I tried looking quickly for docs on this; is it https://cloud.google.com/sdk/gcloud/reference/alpha/emulators? I have no strong opposition to supporting this — it makes a ton of sense for unit testing, and it's possible because ZetaSQL being published and open source — I'd just want to see us doing some light diligence and internal education before documenting this as an officially supported plugin feature. I expect we'll be getting questions on it from lots of interested folks! |
We have not been using it yet, but have been considering it for other purposes (like integration-testing a program that loads data into bigquery), and wanted to check out the feasibility of using it for DBT to reduce the time and complexity in our build-pipeline. As for the bq-tool, you can see it in use in the goccy/bigquery-emulator Readme: https://github.com/goccy/bigquery-emulator#2-call-endpoint-from-bq-client:
|
i’m working on it! You can confirm that the command Don’t forget to run this command beforehand: cd dbt-bigquery-template
poetry install
docker run --rm -p 9050:9050 -v "$(pwd)/emulator.yml:/data/emulator.yml" -it ghcr.io/goccy/bigquery-emulator:latest --project=local --data-from-yaml=/data/emulator.yml You can this: cd dbt
poetry run dbt --debug run --project-dir . --profiles-dir . However, I am now wondering how to address this error...
|
Hi there - We too are looking at leveraging The only issue we ran into was missing projects, datasets, and not having sufficient seed data in the emulator. @ustato My guess is you haven't told the bq-emulatror about the |
Hi, Could you please let me know if big-query emulator is supported already? |
@andrewegel Glad to hear you got
could you please let me know if you faced above and how they are resolved? |
@Dileep17 I ran into the same error as you mentioned - |
@mgguo couldn't get that working! |
@Dileep17 Yeah, I think it's because the emulator API didn't return the expected response as the regular gcp bigquery API. i.e. the @ustato have you got any chance to look back at this patch? were you able to get it working? thanks! |
I did a little sleuthing through code, and from what I can see is from here: https://github.com/googleapis/python-bigquery/blob/main/google/cloud/bigquery/job/base.py#L693-L702 The (part of) response back from BQ-the-real-service shows:
Where-as with the emulator the entire
This is likely because BQ-the-real-service supports the This could either be a feature request in Short term work around could be to patch https://github.com/ustato/dbt-bigquery/blob/9dca9ebcd99f199b685bb35bac7eb32ff8e6624b/dbt/adapters/bigquery/connections.py#L497
As this purely seems to be just for reporting rows on the console, as the sample DBT project works with this "patch":
I opened an issue in that project goccy/bigquery-emulator#197 on the behavior difference. |
I made a PR for this which is working fine, and is less of a change that PR above. Allowing the setting of |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers. |
@andrewegel are you able to share how you applied the patch (was it to the original source or the executable) |
Is this your first time submitting a feature request?
Describe the feature
Add support for profile-configuration and connection to a custom BigQuery endpoint, to allow for emulating BigQuery.
https://docs.getdbt.com/reference/warehouse-setups/bigquery-setup
In addition to "project", "dataset" etc in the profiles.yml, one could specify a "endpoint"-config.
One could then run a BigQuery-emulator (such as https://github.com/goccy/bigquery-emulator), instead of having to run against the real BigQuery.
Note that this is already supported by the
bq
CLI tool.Describe alternatives you've considered
No response
Who will this benefit?
This will benefit teams that want to run DBT unit-tests using https://github.com/mjirv/dbt-datamocktool in CI, to allow multiple branches to run at the same time, without conflicting.
Are you interested in contributing this feature?
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: