Skip to content

Commit fd5c7b2

Browse files
committed
Alternative solution for nflverse#389:
Start with the latest season. This season has column "weather" filled. So BigQuery will choose the right column type STRING.
1 parent fb39b49 commit fd5c7b2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

R/helper_database_functions.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ build_db <- function(tblname = "nflfastR_pbp", db_conn, rebuild = FALSE, show_me
137137
dplyr::filter(.data$season >= 1999 & !is.na(.data$result)) %>%
138138
dplyr::group_by(.data$season) %>%
139139
dplyr::summarise() %>%
140-
dplyr::ungroup()
140+
dplyr::ungroup() %>%
141+
dplyr::arrange(dplyr::desc(season))
141142

142143
if (all(rebuild == TRUE)) {
143144
cli::cli_ul("{my_time()} | Purging the complete data table {.val {tblname}}

R/utils.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ write_pbp <- function(seasons, dbConnection, tablename){
173173
purrr::walk(seasons, function(x, p){
174174
pbp <- nflreadr::load_pbp(x)
175175
if (!DBI::dbExistsTable(dbConnection, tablename)){
176-
default_play$weather <- "some other string"
177176
pbp <- dplyr::bind_rows(default_play, pbp)
178177
}
179178
if (DBI::dbExistsTable(dbConnection, tablename)) {

0 commit comments

Comments
 (0)