-
Notifications
You must be signed in to change notification settings - Fork 74
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
Think about dbListFields() vs. dbColumnInfo() #75
Comments
|
In working on this please keep an eye on what happens with the Postgres drivers. Neither the old RPostgreSQL or the new RPostgres seem to have methods for dbColumnInfo at the moment. |
Postponed to a later release. |
We can't add |
@krlmlr So, what is the plan then? I'm sorry I'm not following |
Something else then, perhaps a new generic altogether -- ? |
Passing as ... seems reasonable at first blush. What's the downside? |
I don't particularly like the name of I'm also not sure if we should prefer two different generics, one for tables given by name, the other for result sets. What would these be called? |
YMMV, but a verbed noun is sometimes challenging is it fetch, get, retrieve, load, etc? That dbColumnInfo works with existing backends does seem to recommend it. dbResultInfo? /shrug |
I'd settle for "get" in this case; rows are "fetched", but rows affected, row number, info etc. are "got" in DBI. Yeah, back compatibility seems an issue. |
Current plan: Add default implementation for |
@hadley: The current implementation of
What are the intended semantics of the |
I think it would be better to consider |
I appreciate all of this is complex and y'all are balancing a number of considerations. I'm going to share my perspective as an outsider to see if it might be informative. dbColumnInfo() operates on a result set whereas dbListFields() operates against a given table. As such dbColumnInfo() seems to provide a service somewhat distinct from dbListFields(). Shouldn't that be programable against / better specified than 'informative for interactive work'? On a related note, right now I use dbColumnInfo() over dbListFields() for getting information about temp tables under
Would a new generic that can be flexible across connection/table vs resultset calls and provide a consistent output, as krlmlr proposed in May last year, be a huge amount of work? [Which might be unrelated to the question of what dbColumnInfo() should return right now]. Thanks to both of you for your time and all of your efforts! |
I think if we did want to provide some common way of returning the names and types of a table and query, we'd be better of starting from scratch rather than using the existing functions. IMO, the right data structure to return would be a zero-row data frame, as there's no standard way of representing R "types" as a string. |
We already have Current |
- The `dbListFields()` method now works correctly if the `name` argument is a quoted identifier or of class `Id`, and throws an error if the table is not found (r-dbi/DBI#75).
- Add default implementation for `dbListFields(DBIConnection, Id)`, this relies on `dbQuoteIdentifier(DBIConnection, Id)` (#75).
- The `dbListFields()` method is now fully specified (#75).
- The `dbColumnInfo()` method is now fully specified (#75).
- Add specification for `dbListFields()` (r-dbi/DBI#75).
- Add specification for `dbColumnInfo()` (r-dbi/DBI#75).
Yes, but |
I'm not sure we can do much better than Let's shelve this for now. |
Specified |
The latter provides more information, but requires a result set. Currently, dplyr seems to require it, too (r-dbi/RMySQL#130 (comment)).
I'd vote for including it again, perhaps with a default implementation that forwards to colnames(dbGetQuery(..., n = 0)) (#76).
The text was updated successfully, but these errors were encountered: