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

r/adbcdrivermanager: behavior of depth argument in adbc_connection_get_objects() #1142

Closed
nbenn opened this issue Oct 1, 2023 · 3 comments · Fixed by #1261
Closed

r/adbcdrivermanager: behavior of depth argument in adbc_connection_get_objects() #1142

nbenn opened this issue Oct 1, 2023 · 3 comments · Fixed by #1261

Comments

@nbenn
Copy link
Collaborator

nbenn commented Oct 1, 2023

Going by the docs I was expecting that passing depth = 4L I get back schema info up to columns.

library(adbcdrivermanager)
db <- adbc_database_init(adbcsqlite::adbcsqlite(), uri = ":memory:")
con <- adbc_connection_init(db)
write_adbc(datasets::swiss, con, "swiss")

res <- nanoarrow::convert_array_stream(
  adbc_connection_get_objects(con, 4L)
)

res[["catalog_db_schemas"]][[1L]][["db_schema_tables"]][[1L]]
#>   table_name table_type table_columns table_constraints
#> 1      swiss      table          NULL              NULL

If I use default depth of 0L, I get the expected info.

@paleolimbot Is 3L the largest "sensible" value? Maybe a warning for larger values would be helpful? Or maybe being a bit more clear about this in the docs? As things stand, it might be a bit misleading.

@paleolimbot
Copy link
Member

I can't speak to this off the top of my head since the concept of a "catalog" is something that I have only recently run into. The first thing I would try is whether a value of 4L works in the Postgres driver (which has seen a little more use than the sqlite driver).

(I can also look into it in the next few days!)

@lidavidm
Copy link
Member

lidavidm commented Oct 5, 2023

/// \brief Return metadata on catalogs, schemas, tables, and columns.
///
/// \see AdbcConnectionGetObjects
#define ADBC_OBJECT_DEPTH_ALL 0
/// \brief Return metadata on catalogs only.
///
/// \see AdbcConnectionGetObjects
#define ADBC_OBJECT_DEPTH_CATALOGS 1
/// \brief Return metadata on catalogs and schemas.
///
/// \see AdbcConnectionGetObjects
#define ADBC_OBJECT_DEPTH_DB_SCHEMAS 2
/// \brief Return metadata on catalogs, schemas, and tables.
///
/// \see AdbcConnectionGetObjects
#define ADBC_OBJECT_DEPTH_TABLES 3
/// \brief Return metadata on catalogs, schemas, tables, and columns.
///
/// \see AdbcConnectionGetObjects
#define ADBC_OBJECT_DEPTH_COLUMNS ADBC_OBJECT_DEPTH_ALL

I suppose I did this backwards. So you want 0.

@paleolimbot
Copy link
Member

@nbenn Are any changes to ADBC required to get the information you need here?

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

Successfully merging a pull request may close this issue.

3 participants