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

API refactor + Oracle fixes #577

Merged
merged 9 commits into from Jun 9, 2023
Merged

API refactor + Oracle fixes #577

merged 9 commits into from Jun 9, 2023

Conversation

detule
Copy link
Collaborator

@detule detule commented Jun 9, 2023

Hi:

Fixes #575 , #540, #554

Some highlights:

  • Previously we had runaway usage of connection_sql_tables, which accommodates "magic" parameter ( combinations ). This makes it difficult to customize parts of its functionality for individual back-ends. Now some of the magic use cases are split out into odbcConnectionCatalogs, odbcConnectionSchemas, and odbcConnectionTableTypes.

  • Specialize some of these for Oracle so that (hopefully) all of these are more performant ( and functional ): listing tables, writing to tables, and Rstudio/Viewer operations.

Use as appropriately ( Viewer.R ).

Also:
- Cleanup odbcConnectionColumns:
 - All S4 methods funnel to a single implementation
   point.
 - No more usage of connection_sql_columns ( outside of
   odbcConnectionColumns )
- Viewer.R:
 - Remove unnecessary dbListTables call in actions
 - list_catalogs is wrapped in tryCatch since not all
   back-ends support catalogs and some ( oracle ) throws
   an exception/error.
R/Viewer.R Outdated Show resolved Hide resolved
R/Viewer.R Outdated
@@ -346,12 +347,12 @@ odbcConnectionActions.default <- function(connection) {
tableName <- dbQuoteIdentifier(connection, firstTable$table_name)

# add schema
if (!is.null(firstTable$table_schema) && nchar(firstTable$table_schema) > 0) {
if (!is.null(firstTable$table_schema) && !is.na(firstTable$table_schema) && nchar(firstTable$table_schema) > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This level of type flexibility always makes me a bit nervous. Could we add some type checks higher up so we only need to check for one empty sentinel?

Copy link
Collaborator Author

@detule detule Jun 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Hadley:

As best as I can tell, the is.null(...) that was there to begin-with is not guarding anything; I think only the is.na is actually effective.

Kind of hesitant to remove the is.null since I am not sure why it was there in the first place. But at the same time this is not in any critical code-path; we can revisit if removing it breaks something.

R/db.R Outdated Show resolved Hide resolved
R/Connection.R Show resolved Hide resolved
R/Connection.R Show resolved Hide resolved
@detule detule merged commit fc10a19 into r-dbi:main Jun 9, 2023
19 checks passed
This was referenced Jun 9, 2023
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 this pull request may close these issues.

Oracle: odbcConnectionColumns no-op
2 participants