paleolimbot opened a new issue, #2248:
URL: https://github.com/apache/arrow-adbc/issues/2248

   ### What happened?
   
   As discovered in 
https://github.com/OSGeo/gdal/pull/11003#discussion_r1799512036 , the 
documentation for `ADBC_OBJECT_DEPTH_DB_SCHEMAS` suggests that using its value 
will result in table metadata; however, using `ADBC_OBJECT_DEPTH_DB_TABLES` is 
required to actually get a list of tables.
   
   
https://github.com/apache/arrow-adbc/blob/cd24bc096612feeef31bff2a9271616cc94e1634/c/include/arrow-adbc/adbc.h#L503-L522
   
   ``` r
   library(adbcdrivermanager)
   
   con <- adbc_database_init(adbcsqlite::adbcsqlite()) |> 
     adbc_connection_init()
   
   
   mtcars |> 
     write_adbc(con, "some_table")
   
   adbc_connection_get_objects(con, depth = 1L) |> 
     tibble::as_tibble() |> 
     tidyr::unnest_longer(catalog_db_schemas) |> 
     tidyr::unnest_wider(catalog_db_schemas) |> 
     tidyr::unnest_longer(db_schema_tables) |> 
     tidyr::unnest_wider(db_schema_tables) |> 
     dplyr::select(-table_constraints) |> 
     tidyr::unnest_longer(table_columns)
   #> # A tibble: 0 × 5
   #> # ℹ 5 variables: catalog_name <chr>, db_schema_name <chr>, table_name 
<chr>,
   #> #   table_type <chr>, table_columns <df[,19]>
   
   adbc_connection_get_objects(con, depth = 2L) |> 
     tibble::as_tibble() |> 
     tidyr::unnest_longer(catalog_db_schemas) |> 
     tidyr::unnest_wider(catalog_db_schemas) |> 
     tidyr::unnest_longer(db_schema_tables) |> 
     tidyr::unnest_wider(db_schema_tables) |> 
     dplyr::select(-table_constraints) |> 
     tidyr::unnest_longer(table_columns)
   #> # A tibble: 1 × 5
   #>   catalog_name db_schema_name table_name table_type 
table_columns$column_name
   #>   <chr>        <chr>          <chr>      <chr>      <chr>                 
   
   #> 1 main         ""             <NA>       <NA>       <NA>                  
   
   #> # ℹ 18 more variables: table_columns$ordinal_position <int>, $remarks 
<chr>,
   #> #   $xdbc_data_type <int>, $xdbc_type_name <chr>, $xdbc_column_size <int>,
   #> #   $xdbc_decimal_digits <int>, $xdbc_num_prec_radix <int>,
   #> #   $xdbc_nullable <int>, $xdbc_column_def <chr>, $xdbc_sql_data_type 
<int>,
   #> #   $xdbc_datetime_sub <int>, $xdbc_char_octet_length <int>,
   #> #   $xdbc_is_nullable <chr>, $xdbc_scope_catalog <chr>,
   #> #   $xdbc_scope_schema <chr>, $xdbc_scope_table <chr>, …
   
   adbc_connection_get_objects(con, depth = 3L) |> 
     tibble::as_tibble() |> 
     tidyr::unnest_longer(catalog_db_schemas) |> 
     tidyr::unnest_wider(catalog_db_schemas) |> 
     tidyr::unnest_longer(db_schema_tables) |> 
     tidyr::unnest_wider(db_schema_tables) |> 
     dplyr::select(-table_constraints) |> 
     tidyr::unnest_longer(table_columns)
   #> # A tibble: 1 × 5
   #>   catalog_name db_schema_name table_name table_type 
table_columns$column_name
   #>   <chr>        <chr>          <chr>      <chr>      <chr>                 
   
   #> 1 main         ""             some_table table      <NA>                  
   
   #> # ℹ 18 more variables: table_columns$ordinal_position <int>, $remarks 
<chr>,
   #> #   $xdbc_data_type <int>, $xdbc_type_name <chr>, $xdbc_column_size <int>,
   #> #   $xdbc_decimal_digits <int>, $xdbc_num_prec_radix <int>,
   #> #   $xdbc_nullable <int>, $xdbc_column_def <chr>, $xdbc_sql_data_type 
<int>,
   #> #   $xdbc_datetime_sub <int>, $xdbc_char_octet_length <int>,
   #> #   $xdbc_is_nullable <chr>, $xdbc_scope_catalog <chr>,
   #> #   $xdbc_scope_schema <chr>, $xdbc_scope_table <chr>, …
   
   adbc_connection_get_objects(con, depth = 0L) |> 
     tibble::as_tibble() |> 
     tidyr::unnest_longer(catalog_db_schemas) |> 
     tidyr::unnest_wider(catalog_db_schemas) |> 
     tidyr::unnest_longer(db_schema_tables) |> 
     tidyr::unnest_wider(db_schema_tables) |> 
     dplyr::select(-table_constraints) |> 
     tidyr::unnest_longer(table_columns)
   #> # A tibble: 1 × 5
   #>   catalog_name db_schema_name table_name table_type   table_columns
   #>   <chr>        <chr>          <chr>      <chr>      <list<df[,19]>>
   #> 1 main         ""             some_table table            [11 × 19]
   ```
   
   <sup>Created on 2024-10-14 with [reprex 
v2.1.1](https://reprex.tidyverse.org)</sup>
   
   ### Stack Trace
   
   _No response_
   
   ### How can we reproduce the bug?
   
   _No response_
   
   ### Environment/Setup
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to