{"id":15060740,"url":"https://github.com/dav009/bqt","last_synced_at":"2026-02-11T17:01:56.898Z","repository":{"id":196300540,"uuid":"694594860","full_name":"dav009/bqt","owner":"dav009","description":"Local unit tests for your BigQuery queries ","archived":false,"fork":false,"pushed_at":"2023-09-30T01:34:59.000Z","size":86,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T07:12:21.454Z","etag":null,"topics":["bigquery","bq","data","test","unittest"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dav009.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-21T10:05:33.000Z","updated_at":"2023-09-29T20:11:41.000Z","dependencies_parsed_at":"2023-09-24T07:14:03.046Z","dependency_job_id":"269b93d8-e614-4363-b956-1a751f8285bb","html_url":"https://github.com/dav009/bqt","commit_stats":null,"previous_names":["dav009/bqt"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dav009/bqt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dav009%2Fbqt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dav009%2Fbqt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dav009%2Fbqt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dav009%2Fbqt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dav009","download_url":"https://codeload.github.com/dav009/bqt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dav009%2Fbqt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269366853,"owners_count":24405250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bigquery","bq","data","test","unittest"],"created_at":"2024-09-24T23:03:45.525Z","updated_at":"2026-02-11T17:01:51.864Z","avatar_url":"https://github.com/dav009.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BQT: BigQuery Testing CLI Tool\n\nBQT is a CLI tool designed to facilitate unit testing for BigQuery queries. It enables users to define mock data and anticipated outputs for their BigQuery queries, providing a simulated environment for accurate testing. BQT ensures that the actual query outputs align with the mocked outputs.\n\nBQT does not need access to BigQuery cloud resources. It uses a small and fast simulator which you can run either locally or on your CI.\n\n## Usage example:\n\n\u003e bqt test --tests tests_folder\n\n- `test_folder`: is a folder with `json` files defining tests.\n\nbqt output tells you if there are failing tests:\n\n```bash\n/bqt test --tests tests_data\nParsing tests in:  tests_data\nDetected test: tests_data/test1.json\nDetected test: tests_data/test2.json\nDetected test: tests_data/test3.json\nDetected test: tests_data/test4.json\nDetected test: tests_data/test5.json\nParsed Tests:  5\nRunning Tests...\n\nRunning Test: simple_test : tests_data/test1.json\n✅ Test Success: simple_test : tests_data/test1.json\n\nRunning Test: simple_test : tests_data/test2.json\n✅ Test Success: simple_test : tests_data/test2.json\n\nRunning Test: simple_test : tests_data/test3.json\n\t------Unexpected data-------\n\tcolumn2 : something2\n\tv : 2\n\t-------------\n✅ Test Success: simple_test : tests_data/test3.json\n\nRunning Test: simple_test : tests_data/test4.json\n\t------Unexpected data-------\n\tcolumn2 : something2\n\tv : 2\n\t-------------\n\t------Missing Dataa-------\n\tcolumn2 : something5\n\tv : 5\n\t-------------\n\tError: Expected data is missing..\n❌ Test Failed: simple_test : tests_data/test4.json\n\nRunning Test: simple_test : tests_data/test5.json\n\t------Unexpected data-------\n\tcolumn2 : something\n\tv : 1\n\t-------------\n\t------Unexpected data-------\n\tcolumn2 : something2\n\tv : 2\n\t-------------\n\t------Missing Dataa-------\n\tcolumn2 : something5\n\tv : 5\n\t-------------\n\tError: Expected data is missing..\n❌ Test Failed: simple_test : tests_data/test5.json\n2023/09/23 16:22:26 Some tests failed\n\n```\n\n### Test files\n\n- BQT uses tests defined in json you can see examples in this repo's `tests_data` folder\n\nsample test:\n\n```json\n{\n    \"name\": \"simple_test\",\n    \"file\": \"tests_data/test1.sql\",\n    \"mocks\": {\n        \"`dataset`.`table`\": {\n            \"filepath\": \"tests_data/test1_in1.csv\",\n            \"types\": {\n                \"c1\": \"int64\"\n            }\n       }\n    },\n    \"output\": {\n        \"filepath\": \"tests_data/out.csv\",\n        \"types\": {\n                \"column1\": \"string\"\n            }\n    }\n}\n```\n\nthis test:\n- `tests_data/test1.sql` this is the query being tested\n- `dataset`.`table` this table in the SQL query is mocked with data defined in `tests_data/test1_in1.csv`\n- the output of this query has to match the data defined in `tests_data/out.csv`\n\n## Installation\n\n### Nix \n\nYou can use the nix flake to build/run/develop this project:\n\n- `nix profile install github:dav009/bqt`\n- `bqt --help`\n\nYou can also use the flake to build/run:\n- `nix build github:dav009/bqt`\n- `nix run github:dav009/bqt`\n\n### Other\n\n- `go install github.com/dav009/bqt/cmd/bqt@latest`\n\n### Download from releases\n\n- Download binary from Github releases\n\n## Details\n\n- bqt runs a BQ simulator to run queries\n- bqt does some simple string replacement to find table names and replace table references with mock data\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdav009%2Fbqt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdav009%2Fbqt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdav009%2Fbqt/lists"}