What tidyverse packages work together to connect to a database?

For R to retrieve data from an SQL database (say, PostgreSQL) are functions from all these packages involved?


Bonus question: is there a way that I can inspect a query to verify this?

So, this is from the big data with R workshop that we just held in Austin last week (all materials available here), and it certainly resembles what you have above:

As for inspecting you can, at the very least, translate_sql()

This page might be of interest as well:


FANTASTIC! Super helpful!

My understanding of translate_sql() is that it represents what is sent to PostgreSQL. I'm wondering if there's a mechanism that lets me see the function stack involved between "me" and the database.

It's also what is translated from dplyr code by dbplyr and sent to DBI. (There's more detail on that in the slides from the big data class, and how it helps avoid SQL injection, etc).

As for the other parts of the stack, I'm not really sure. You might look through some of the DBI documentation, and consider stepping through those functions:

The DBI Special Interest Group (SIG) has its proposal, and a quite detailed schematic drawing of how things are done, etc:

Everything in there is open source, so you can quite literally go through the code, though hopefully there's a more efficient mechanism I'm not thinking of.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.