apache / arrow-adbc

Database connectivity API standard and libraries for Apache Arrow
https://arrow.apache.org/adbc/
Apache License 2.0
360 stars 87 forks source link

r/adbcdrivermanager: `adbc_connection_get_objects()` for temporary tables #1141

Closed nbenn closed 5 months ago

nbenn commented 11 months ago

Ingesting tables as TEMPORARY works fine

library(adbcdrivermanager)

db <- adbc_database_init(adbcsqlite::adbcsqlite(), uri = ":memory:")
con <- adbc_connection_init(db)

write_adbc(datasets::swiss, con, "swiss", temporary = TRUE)

as.data.frame(read_adbc(con, "SELECT * from swiss WHERE Agriculture < 20"))
#>   Fertility Agriculture Examination Education Catholic Infant.Mortality
#> 1      80.2        17.0          15        12     9.96             22.2
#> 2      55.7        19.4          26        28    12.11             20.2
#> 3      54.3        15.2          31        20     2.15             10.8
#> 4      65.7         7.7          29        11    13.79             20.5
#> 5      72.7        16.7          22        13    11.22             18.9
#> 6      64.4        17.6          35        32    16.92             23.0
#> 7      67.6        18.7          25         7     8.65             19.5
#> 8      35.0         1.2          37        53    42.34             18.0

but listing via adbc_connection_get_objects() is less straightforward.

res <- nanoarrow::convert_array_stream(
  adbc_connection_get_objects(con)
)

res
#>   catalog_name catalog_db_schemas
#> 1         main                 NA

res[["catalog_db_schemas"]][[1L]]
#>   db_schema_name db_schema_tables
#> 1           <NA>

@paleolimbot Am I missing something? Should I be passing some value as table_type to have temporary tables included? The docs indicate that the default value NULL corresponds to "tables of any type".

Or is this an upstream issue?

lidavidm commented 11 months ago

The SQLite driver only looks at the "main" catalog (so you would also see this if you tried to attach a database)