duckdblabs/duckplyr

Is it possible to get table name to be used in dbplyr::sql

Opened this issue · 2 comments

I am trying to add an operation to the end of my pipeline that uses the duckdb PIVOT expression.

To use dbplyr::sql() with a manual sql query I would need to get the name of the table that is used in the query which is created by as_duckplyr_df(). Is that possible?

Alternatively, is it possible to map the duckdb PIVOT expression to dplyr verbs?

Thanks, interesting use case. None of this seems to be available out of the box, but making a data frame available in duckdb via duckdb::duckdb_register() is instantaneous, perhaps with a small performance overhead during runtime.

The first option would be the equivalent of compute(), with a way to feed the result into an SQL expression. Let me think about an API here.

Ideally, we would support pivot_wider() and pivot_longer() natively, this seems to be much further down the road.

Are #86 or #139 related?