{"id":21100156,"url":"https://github.com/tosh2230/sfb","last_synced_at":"2026-05-21T06:01:14.260Z","repository":{"id":46293604,"uuid":"330989315","full_name":"tosh2230/sfb","owner":"tosh2230","description":"Cost estimator for Google BigQuery","archived":false,"fork":false,"pushed_at":"2021-11-01T14:36:32.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-25T17:13:20.930Z","etag":null,"topics":["cost-estimator","gcp","google-bigquery","sql"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/sfb/","language":"Python","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/tosh2230.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}},"created_at":"2021-01-19T13:28:52.000Z","updated_at":"2021-10-22T14:40:21.000Z","dependencies_parsed_at":"2022-09-14T21:01:18.668Z","dependency_job_id":null,"html_url":"https://github.com/tosh2230/sfb","commit_stats":null,"previous_names":["tosh223/sfb"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tosh2230/sfb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosh2230%2Fsfb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosh2230%2Fsfb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosh2230%2Fsfb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosh2230%2Fsfb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tosh2230","download_url":"https://codeload.github.com/tosh2230/sfb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosh2230%2Fsfb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33290928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cost-estimator","gcp","google-bigquery","sql"],"created_at":"2024-11-19T23:03:06.172Z","updated_at":"2026-05-21T06:01:14.227Z","avatar_url":"https://github.com/tosh2230.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sfb\n\n[![CI](https://github.com/tosh223/sfb/actions/workflows/ci.yml/badge.svg)](https://github.com/tosh223/sfb/actions/workflows/ci.yml)\n\nsfb helps SQL testing and estimating the cost of services that depend on scan volume.\n\n## Description\n\n- Check SQL syntax\n- Estimate query costs for free\n    - per Run\n    - per Month\n- Replace query parameters automatically\n- Be useful on continuous integration\n- Use dryrun include [Google BigQuery API Client Libraries](https://cloud.google.com/bigquery/docs/reference/libraries)\n\n## Install\n\n```sh\n$ pip install sfb\n```\n\n## Requirements\n\n- Python \u003e= 3.6\n    - Jupyter Notebook\n    - Google Colaboratory\n- google-cloud-bigquery \u003e= 2.6.1\n- pyyaml \u003e= 5.4.1\n\n## Usage\n\n### Estimate Query Costs\n\n```sh\n# If runs with no arguments, execute files in './sql/*.sql'.\n$ sfb\n{\n  \"Succeeded\": [\n    {\n      \"SQL File\": \"/home/admin/project/sfb_test/sql/covid19_open_data.covid19_open_data.sql\",\n      \"Total Bytes Processed\": \"1.9 GiB\",\n      \"Estimated Cost($)\": {\n        \"per Run\": 0.009414,\n        \"per Month\": 0.28242\n      },\n      \"Frequency\": \"Daily\"\n    },\n    {\n      ...\n    }\n  ],\n  \"Failed\": [\n    {\n      \"SQL File\": \"/home/admin/project/sfb_test/sql/test_failure_badrequest_01.sql\",\n      \"Errors\": [\n        {\n          \"message\": \"Unrecognized name: names; Did you mean name? at [9:5]\",\n          \"domain\": \"global\",\n          \"reason\": \"invalidQuery\",\n          \"location\": \"q\",\n          \"locationType\": \"parameter\"\n        }\n      ]\n    },\n    {\n      ...\n    }\n  ]\n}\n```\n\n```sh\n# Others\n$ sfb -f ./sql/*.sql\n$ sfb -q \"select * from test;\"\n$ echo \"select * from test;\" | sfb | jq\n$ find ./sql -type f | sfb\n```\n\n### Arguments\n\n```sh\n$ sfb -h\nusage: sfb [-h] [-f [FILE [FILE ...]] | -q QUERY] [-c CONFIG] [-v] [-d]\n           [-p PROJECT] [-k KEY]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -f [FILE [FILE ...]], --file [FILE [FILE ...]]\n                        sql file path\n  -q QUERY, --query QUERY\n                        query string\n  -c CONFIG, --config CONFIG\n                        sfb config path\n  -p PROJECT, --project PROJECT\n                        GCP project\n  -k KEY, --key KEY\n                        GCP service account key path\n  -v, --verbose         return verbose results\n  -d, --debug           run as debug mode\n```\n\n### Directory (Optional)\n\n```sh\n$ tree .\n.\n├── config\n│   └── sfb.yaml\n├── log\n│   └── sfb.log (if runs as debug mode)\n└── sql\n    └── [SQL files here]\n```\n\n### Configuration\n\n```sh\n$ cat ./config/sfb.yaml\n\n# Default settings\nGlobals:\n  Service: BigQuery\n  Location: US\n  Frequency: Daily\n\nQueryFiles:\n  [your_sql_file_name]:\n    Frequency: Weekly\n    Parameters:\n    - name: ds_start_date\n      type: DATE\n      value: '2020-01-01'\n    - name: ds_end_date\n      type: DATE\n      value: '2020-01-31'\n  ...\n```\n\n#### Type\n\nName of query parameter type. Select one of types below.\n\n- STRING\n- INT64\n- FLOAT64\n- NUMERIC\n- BOOL\n- TIMESTAMP\n- DATETIME\n- DATE\n\n#### Frequency\n\nFor calculating monthly cost estimation.\n\n- Hourly\n    - (cost_per_run) * 30(days) * 24(h)\n- Daily\n    - (cost_per_run) * 30(days)\n- Weekly\n    - (cost_per_run) * 4(weeks)\n- Monthly\n    - cost_per_run\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftosh2230%2Fsfb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftosh2230%2Fsfb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftosh2230%2Fsfb/lists"}