Skip to content

Commit

Permalink
Alternative solution for nflverse#389:
Browse files Browse the repository at this point in the history
Start with the latest season. This season has column "weather" filled. So BigQuery will choose the right column type STRING.
  • Loading branch information
rstats-tips committed Oct 16, 2022
1 parent fb39b49 commit fd5c7b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion R/helper_database_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ build_db <- function(tblname = "nflfastR_pbp", db_conn, rebuild = FALSE, show_me
dplyr::filter(.data$season >= 1999 & !is.na(.data$result)) %>%
dplyr::group_by(.data$season) %>%
dplyr::summarise() %>%
dplyr::ungroup()
dplyr::ungroup() %>%
dplyr::arrange(dplyr::desc(season))

if (all(rebuild == TRUE)) {
cli::cli_ul("{my_time()} | Purging the complete data table {.val {tblname}}
Expand Down
1 change: 0 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ write_pbp <- function(seasons, dbConnection, tablename){
purrr::walk(seasons, function(x, p){
pbp <- nflreadr::load_pbp(x)
if (!DBI::dbExistsTable(dbConnection, tablename)){
default_play$weather <- "some other string"
pbp <- dplyr::bind_rows(default_play, pbp)
}
if (DBI::dbExistsTable(dbConnection, tablename)) {
Expand Down

0 comments on commit fd5c7b2

Please sign in to comment.