r-dbi / bigrquery

An interface to Google's BigQuery from R.
https://bigrquery.r-dbi.org
Other
516 stars 183 forks source link

No bq_table_update() - why? what to use instead? #309

Closed eamcvey closed 4 years ago

eamcvey commented 5 years ago

I imagine this question is less an issue and more confusion on my part ... I'm trying to update data in a BigQuery table from R with a daily job, which should overwrite the table contents each day rather than append to it (this will be scheduled in RStudio Connect). I was expecting to find a bq_table_update() function in bigrquery but it seems there is not one. What function should I use instead?

FYI, I posted this question on RStudio Community here

byapparov commented 5 years ago

I think you need 'bq_perform_upload', e.g. see here: https://github.com/madedotcom/retl/blob/8398ff7b79b6af81a1a0f3b06c46378b831f9332/R/bigquery.R#L756

If your data comes from query, you need to save it with 'bq_perform_query', see example: https://github.com/madedotcom/retl/blob/8398ff7b79b6af81a1a0f3b06c46378b831f9332/R/bigquery.R#L369

warnes commented 5 years ago

If you use the DBI interface, you can use dbWriteTable(con, "table_name", df, overwrite=TRUE)