Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning a duckdb table to R via tbl() prints an error if a schema name is used #39

Closed
BorgeJorge opened this issue Nov 4, 2023 · 1 comment

Comments

@BorgeJorge
Copy link

BorgeJorge commented Nov 4, 2023

con <- dbConnect(duckdb())
dbWriteTable(con, "mtcars", mtcars)

# the following works:
tbl(con,"mtcars")

# the following also seems to work, but it prints an error: "It looks like you tried to incorrectly use a table in a schema as source."
tbl(con,"main.mtcars")

# The error is printed whenever you use tbl() with a schema name

@m-muecke
Copy link
Contributor

m-muecke commented Nov 8, 2023

That is not a duckdb issue. You have to use the dbplyr::in_schema function, i.e. tbl(con, in_schema("schema", "table"). If you don't specify the table schema in the write table it will write to the default schema anyway. If you want to specify the schema for the table location when writing the table you need to specify it with DBI::Id(schema = "schema", table = "table") as well.

@krlmlr krlmlr closed this as completed Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants