I would like to write a table from R to snowflake using
DBI::dbWriteTable(
conn = con,
name = DBI::SQL("db.schema.table"),
value = df
)
Table consists of 2 columns : numeric
,list/json
.
The problem is that 1 of the columns consists of jsons and it doesn't allow to write the table.
Data type in snowflake should be variant
.
What modifications should I make, so I could write the table and at the end the data type is variant
in snowflake?
Data
An error message:
Error in result_insert_dataframe(rs@ptr, values, batch_rows) : RAW() can only be applied to a 'raw', not a 'character'
And here the data example:
structure(list(id = c("1", "2"), json = list(structure("[\n {\n \"_id\": 1,\n \"source_house_id\": \"68\",\n \"source_room_id\": 33719,\n \"substitute_rules\": [\n {\n \"destination_house_id\": \"388\",\n \"destination_room_id\": 45231\n },\n {\n \"destination_house_id\": \"478\",\n \"destination_room_id\": 65216\n },\n {\n \"destination_house_id\": \"503\",\n \"destination_room_id\": 67624\n }\n ]\n }\n]", class = "json"),
structure("[\n {\n \"_id\": 2,\n \"source_house_id\": \"334\",\n \"source_room_id\": 44329,\n \"substitute_rules\": [\n {\n \"destination_house_id\": \"479\",\n \"destination_room_id\": 65217\n }\n ]\n }\n]", class = "json"))), class = "data.frame", row.names = c(NA,
-2L))