Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add two utility functions export_parquet and create_view and a vignette on how to materialize data.#1177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
nbc wants to merge1 commit intoduckdb:main
base:main
Choose a base branch
Loading
fromnbc:feature/export_and_view

Conversation

@nbc
Copy link

@nbcnbc commentedMay 25, 2025

This PR add two utility functions :

  • export_parquet uses COPY TO to export a parquet file from a tbl_lazy
  • create_view creates a view based on a tbl_lazy

The vignette explains how to materialize data using these two functions, as well as with the lesser-known dbplyr::compute() function.

Fixes#207,#630

…vignette* export_parquet uses COPY TO to export a parquet file from a tbl_lazy* create_view creates a view based on a tbl_lazyThe vignette explains how to materialize data with those two functions and dbplyr::compute()Fixesduckdb#207,duckdb#630
@nbcnbcforce-pushed thefeature/export_and_view branch fromb89ba2e toa0fbed6CompareMay 26, 2025 09:00
@krlmlr
Copy link
Collaborator

Thanks for the effort. The code looks good, I'm still not ready to assume maintenance for it.

I labeled the issues as "help wanted" before duckplyr 1.1.0. Writing to Parquet works there:

library(tidyverse)library(duckdb)#> Loading required package: DBIcon<- dbConnect(duckdb::duckdb())dbWriteTable(con,"my_tbl",data.frame(a=1))dbplyr_tbl<- tbl(con,"my_tbl")dbplyr_tbl %>%duckplyr::as_duckdb_tibble()|>duckplyr::compute_parquet("my_tbl.parquet")#> # A duckplyr data frame: 1 variable#>       a#>   <dbl>#> 1     1duckplyr_parquet<-duckplyr::read_parquet_duckdb("my_tbl.parquet")duckplyr_parquet#> # A duckplyr data frame: 1 variable#>       a#>   <dbl>#> 1     1

Created on 2025-06-17 withreprex v2.1.1

As for creating a view, dbplyr or a related package is a better fit, this functionality seems general enough to work across databases.

I'd like to keep the package vignette-free for shorter build times. Otherwise, eachR CMD build . will have to install the package.

Happy to see this code thrive elsewhere!

nbc reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

What is the canonical way to write parquet to disk using duckdb and dbplyr without collecting first?

2 participants

@nbc@krlmlr

[8]ページ先頭

©2009-2025 Movatter.jp