bigrquery
bigrquery copied to clipboard
Unable to create partitioned tables...again
Hi,
This issue is related to #359.
I tried to generate a partitioned table with the solutions within the above issue and encountered some problems. Not sure if this is caused by version updates.
- Specifiy the fields as json: for a json like this:
name = c('date','dummy_columnA','dummy_columnB')
type = c('DATE','STRING','INT64')
schema = jsonlite::toJSON(as.data.frame(cbind(name,type)))
schema
#> [{"name":"date","type":"DATE"},{"name":"dummy_columnA","type":"STRING"},{"name":"dummy_columnB","type":"INT64"}]
I tried the following scripts:
bigrquery::bq_table_create(x = bq_table, fields = schema,
timePartitioning = list(timepartitioning = list(type='DAY', field= 'date'))
)
an error returned
#> Error in UseMethod("as_bq_fields"): no applicable method for 'as_bq_fields' applied to an object of class "json"
- Specify the field as bq_fields
bq_fields <- bigrquery::as_bq_fields(list(bigrquery::bq_field('date','DATE'),
bigrquery::bq_field('dummy_columnA','STRING'),
bigrquery::bq_field('dummy_columnB','INT64')))
bigrquery::bq_table_create(x = bq_table, fields = bq_fields,
timePartitioning = list(timepartitioning = list(type='DAY', field= 'date'))
)
A partitioned table is generated, whereas the field setting is not working.
NOTES: The following bq commend works for me:
bq mk \
--schema=date:DATE,dummy_colA:STRING,dummy_colB:INTEGER \
--time_partitioning_field=date \
--time_partitioning_type=DAY bi_report.dummy_user_profile
You have double layer of timepartitoning lists. Can you double check the example from the previous issue
Closing this since it's been 2 years without further communication.