Skip to content

Commit

Permalink
Make it clearer how to get started with an account (#575)
Browse files Browse the repository at this point in the history
Fixes #341
  • Loading branch information
hadley authored Nov 9, 2023
1 parent 887c328 commit d9e8940
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 61 deletions.
22 changes: 6 additions & 16 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ natality %>%

## Important details

### BigQuery account

To use bigrquery, you'll need a BigQuery project. Fortunately, if you just want to play around with the BigQuery API, it's easy to start with Google's free [public data](https://cloud.google.com/bigquery/public-data) and the [BigQuery sandbox](https://cloud.google.com/bigquery/docs/sandbox). This gives you some fun data to play with along with enough free compute (1 TB of queries & 10 GB of storage per month) to learn the ropes.

To get started, open <https://console.cloud.google.com/bigquery> and create a project. Make a note of the "Project ID" as you'll use this as the `billing` project whenever you work with free sample data; and as the `project` when you work with your own data.

### Authentication and authorization

When using bigrquery interactively, you'll be prompted to [authorize bigrquery](https://cloud.google.com/bigquery/docs/authorization) in the browser. You'll be asked if you want to cache tokens for reuse in future sessions. For non-interactive usage, it is preferred to use a service account token, if possible. More places to learn about auth:
Expand All @@ -123,22 +129,6 @@ When using bigrquery interactively, you'll be prompted to [authorize bigrquery](

Note that bigrquery requests permission to modify your data; but it will never do so unless you explicitly request it (e.g. by calling `bq_table_delete()` or `bq_table_upload()`). Our [Privacy policy](https://www.tidyverse.org/google_privacy_policy) provides more info.

### Billing project

If you just want to play around with the BigQuery API, it's easiest to start with Google's free [sample data](https://cloud.google.com/bigquery/public-data). You'll still need to create a project, but if you're just playing around, it's unlikely that you'll go over the free limit (1 TB of queries / 10 GB of storage).

To create a project:

1. Open https://console.cloud.google.com/ and create a project.
Make a note of the "Project ID" in the "Project info" box.

1. Click on "APIs & Services", then "Dashboard" in the left the left menu.

1. Click on "Enable Apis and Services" at the top of the page,
then search for "BigQuery API" and "Cloud storage".

Use your project ID as the `billing` project whenever you work with free sample data; and as the `project` when you work with your own data.

## Useful links

* [SQL reference](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators)
Expand Down
80 changes: 35 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ bq_table_download(tb, n_max = 10)
#> # A tibble: 10 × 4
#> year month day weight_pounds
#> <int> <int> <int> <dbl>
#> 1 1969 10 7 7.56
#> 2 1969 5 9 6.62
#> 3 1969 2 6 2.00
#> 4 1969 1 8 8.44
#> 5 1969 6 23 9.81
#> 6 1969 7 31 7.19
#> 7 1969 11 6 7.50
#> 8 1969 12 19 7.50
#> 9 1969 2 17 7.05
#> 10 1969 5 3 8.50
#> 1 1969 11 29 8.00
#> 2 1969 4 4 7.37
#> 3 1969 9 6 10.9
#> 4 1969 5 13 3.25
#> 5 1969 8 4 7.63
#> 6 1969 7 6 6.88
#> 7 1969 4 21 7.25
#> 8 1969 9 12 8.02
#> 9 1969 2 13 8.00
#> 10 1969 10 22 6.81
```

### DBI
Expand All @@ -99,16 +99,16 @@ dbGetQuery(con, sql, n = 10)
#> # A tibble: 10 × 4
#> year month day weight_pounds
#> <int> <int> <int> <dbl>
#> 1 1969 10 7 7.56
#> 2 1969 5 9 6.62
#> 3 1969 2 6 2.00
#> 4 1969 1 8 8.44
#> 5 1969 6 23 9.81
#> 6 1969 7 31 7.19
#> 7 1969 11 6 7.50
#> 8 1969 12 19 7.50
#> 9 1969 2 17 7.05
#> 10 1969 5 3 8.50
#> 1 1969 11 29 8.00
#> 2 1969 4 4 7.37
#> 3 1969 9 6 10.9
#> 4 1969 5 13 3.25
#> 5 1969 8 4 7.63
#> 6 1969 7 6 6.88
#> 7 1969 4 21 7.25
#> 8 1969 9 12 8.02
#> 9 1969 2 13 8.00
#> 10 1969 10 22 6.81
```

### dplyr
Expand All @@ -117,9 +117,6 @@ dbGetQuery(con, sql, n = 10)
library(dplyr)

natality <- tbl(con, "natality")
#> Warning: <BigQueryConnection> uses an old dbplyr interface
#> ℹ Please install a newer version of the package or contact the maintainer
#> This warning is displayed once every 8 hours.

natality %>%
select(year, month, day, weight_pounds) %>%
Expand All @@ -142,6 +139,21 @@ natality %>%

## Important details

### BigQuery account

To use bigrquery, you’ll need a BigQuery project. Fortunately, if you
just want to play around with the BigQuery API, it’s easy to start with
Google’s free [public
data](https://cloud.google.com/bigquery/public-data) and the [BigQuery
sandbox](https://cloud.google.com/bigquery/docs/sandbox). This gives you
some fun data to play with along with enough free compute (1 TB of
queries & 10 GB of storage per month) to learn the ropes.

To get started, open <https://console.cloud.google.com/bigquery> and
create a project. Make a note of the “Project ID” as you’ll use this as
the `billing` project whenever you work with free sample data; and as
the `project` when you work with your own data.

### Authentication and authorization

When using bigrquery interactively, you’ll be prompted to [authorize
Expand Down Expand Up @@ -173,28 +185,6 @@ never do so unless you explicitly request it (e.g. by calling
policy](https://www.tidyverse.org/google_privacy_policy) provides more
info.

### Billing project

If you just want to play around with the BigQuery API, it’s easiest to
start with Google’s free [sample
data](https://cloud.google.com/bigquery/public-data). You’ll still need
to create a project, but if you’re just playing around, it’s unlikely
that you’ll go over the free limit (1 TB of queries / 10 GB of storage).

To create a project:

1. Open <https://console.cloud.google.com/> and create a project. Make
a note of the “Project ID” in the “Project info” box.

2. Click on “APIs & Services”, then “Dashboard” in the left the left
menu.

3. Click on “Enable Apis and Services” at the top of the page, then
search for “BigQuery API” and “Cloud storage”.

Use your project ID as the `billing` project whenever you work with free
sample data; and as the `project` when you work with your own data.

## Useful links

- [SQL
Expand Down

0 comments on commit d9e8940

Please sign in to comment.