I need some help with parallel processing of sql queries. Below is the structure of my code as well as the error.
The code to extract the data from SQL Server that works.
con %>%
dplyr::tbl("Audit") %>%
dplyr::filter(Timestamp == max(Timestamp, na.rm = TRUE)) %>%
dplyr::collect()
Output from this query:
A tibble: 1 x 6
Id Timestamp Change User Ref_key Ref_type
1 29549 2021-06-01 08:38:44 From (Project Id): To (Project Id): 5505 user1 9578 WBS
Converting the code above to support parallel processing:
promises::future_promise({
con %>%
dplyr::tbl("Audit") %>%
dplyr::filter(Timestamp == max(Timestamp, na.rm = TRUE)) %>%
dplyr::collect()
}) %...>% print()
Output for this query produces the following:
Unhandled promise error: no applicable method for 'db_query_fields' applied to an object of class "Microsoft SQL Server"
Unhandled promise error: no applicable method for 'db_query_fields' applied to an object of class "Microsoft SQL Server"
Help will be appreciated thanks.
PS - can't provide access to the db so hopefully the examples above is simplistic enough.