https://github.com/kyoshidajp/bqcop
Save your BigQuery cost.
https://github.com/kyoshidajp/bqcop
bigquery golang
Last synced: 29 days ago
JSON representation
Save your BigQuery cost.
- Host: GitHub
- URL: https://github.com/kyoshidajp/bqcop
- Owner: kyoshidajp
- License: mit
- Created: 2018-12-08T05:21:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-03T02:41:33.000Z (over 4 years ago)
- Last Synced: 2025-03-06T17:54:00.152Z (over 1 year ago)
- Topics: bigquery, golang
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
# :policeman: bqcop
[][release]
[](https://travis-ci.org/kyoshidajp/bqcop)
[][godocs]
[][license]
[release]: https://github.com/kyoshidajp/bqcop/releases
[license]: https://github.com/kyoshidajp/bqcop/blob/master/LICENSE
[godocs]: http://godoc.org/github.com/kyoshidajp/bqcop
**bqcop** is CLI to fetch BigQuery jobs and store it to DB.
## Usage
```
bqcop -project-id=project-id -auth-json=auth-json [options...]
```
Fetch BigQuery jobs executed during the **24 hours from now** by calling [Jobs list API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/list) and store it to DB.
### Options
```
-project-id Project ID of BigQuery.
-auth-json Auth File of BigQuery.
-db-dialect Dialect of Database.
default: sqlite3
-db-path Path of Database.
default: sqlite.db
-d, --debug Enable debug mode.
-v, --version Print current version.
```
### Output
`sqlite.db` which has `bq_jobs` will be generated in your current directory if both `-db-dialect` and `-db-path` are not specified.
Schema of `bq_jobs` table.
| field | type | description |
| ----- | ---- | --- |
| id | integer | primary key |
| created_at | datetime | created time |
| updated_at | datetime | updated time |
| deleted_at | datetime | deleted time |
| job_id | varchar(255) | job id |
| query | varchar(255) | job query |
| user_email | varchar(255) | user who exec query |
| total_bytes_billed | bigint | total bytes of billed |
| start_time | datetime | job started time |
| end_time | datetime | job ended time |
## Install
### go get
If you are a Golang developper/user; then execute `go get`.
```
$ go get -u github.com/kyoshidajp/bqcop
```
### Manual
1. Download binary which meets your system from [Releases](https://github.com/kyoshidajp/bqcop/releases).
1. Unarchive it.
1. Put `bqcop` where you want.
1. Add `bqcop` path to `$PATH`.
## Author
[Katsuhiko YOSHIDA](https://github.com/kyoshidajp)