Skip to content

feat: support for dataform test #97

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

Open
ashish10alex opened this issue Jan 28, 2025 · 0 comments
Open

feat: support for dataform test #97

ashish10alex opened this issue Jan 28, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@ashish10alex
Copy link
Owner

Yes, that solved it, thank you very much for this excellent extension!

I had hated using the GCP Dataform web UI for development. I prefer VScode and the dataform CLI. I had built some makefile rules around the dataform cli (e.g. to generate a dependency graph, view the schema of a source). Your extension greatly improves my workflow!

Can I suggest a feature? Dataform unit tests are not supported in GCP and even the cli dataform test command can be a bit tricky to debug errors in your test. It does not allow you to execute a single test and show the compiled query, the output and the expected output.

My makefile rule for the above (example usage make df-test-file name=TRANSFERS):

format_flag := $(if $(format),--format=$(format),)
df-test-file: # Run a single dataform test query with 'name=' [format=prettyjson]
	@echo "Running test query:"
	@dataform compile --json  | jq -r '.tests[] | select(.name == "$(name)") | .testQuery' | nl -ba
	@echo "Actual output:"
	@dataform compile --json  | jq -r '.tests[] | select(.name == "$(name)") | .testQuery' | bq query --nouse_legacy_sql $(format_flag)
	@echo "Expecting output:"
	@dataform compile --json  | jq -r '.tests[] | select(.name == "$(name)") | .expectedOutputQuery' | bq query --nouse_legacy_sql $(format_flag)

Originally posted by @IzakMaraisTAL in #94

@ashish10alex ashish10alex added the enhancement New feature or request label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant