Closed avm19 closed 2 months ago
Thanks for reporting!
This seems to work with arrays that have zero items (but not stream with zero arrays):
library(adbcdrivermanager)
#> Warning: package 'adbcdrivermanager' was built under R version 4.3.3
con <- adbc_database_init(
adbcpostgresql::adbcpostgresql(),
uri = "postgresql://localhost:5432/postgres?user=postgres&password=password"
) |>
adbc_connection_init()
con |>
execute_adbc("DROP TABLE IF EXISTS no_integers")
# Works (stream with one zero-size array)
data.frame(x = integer()) |>
write_adbc(con, "no_integers")
# Fails (stream with zero arrays)
nanoarrow::basic_array_stream(
list(),
nanoarrow::na_struct(list(x = nanoarrow::na_int32()))
) |>
write_adbc(con, "no_integers")
#> Error in adbc_statement_execute_query(stmt): INVALID_ARGUMENT: [libpq] Failed to create table: ERROR: relation "no_integers" already exists
#>
#> Query was: CREATE TABLE "public" . "no_integers" ("x" INTEGER)
Created on 2024-08-11 with reprex v2.1.0
What happened?
Cursor.adbc_ingest()
throws an error when an empty table is passed:Expected behaviour: creates/replaces/appends a table with 0 rows.
I am using Python:
This works:
After changing
n=10
ton=0
to create a table with 0 rows, the same code fails:A quick check showed that we get the same error irrespectively of
mode
andtemporary
arguments.Stack Trace
No response
How can we reproduce the bug?
No response
Environment/Setup
Python 3.11, installed via pip: