-
Notifications
You must be signed in to change notification settings - Fork 107
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
dbAppendTable: do not check for existence twice #691
Conversation
Not in love with the argument name or style. Feedback welcome! |
What if we just remove We might instead (or also?) consider moving the append part of |
Possibly related to #480. Will wait to review pending discussion of ^^^! |
@simonpcouch ah yes, good catch! |
Hey Hadley, Simon: I like the idea of letting the DB report the error - made the change, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine to do the bigger change in separate PR, but you might want to note that this one fixes #480, and if you don't start work on the next change right away, make an issue so we don't forget about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on board!🙂
I'll merge this just so it's in the next release. |
Looks like this breaks some tests so I'll hold off on until after this release. |
Sorry about that - figured out why I went with the new argument to Given that the release is out the door, i might spend a bit of time to try and fit this within the |
No problems; hopefully the fix will fall in a fairly straightforward way once |
* dbWriteTable calls dbAppendTable * dbAppendTable does not check for table existence / back-end can report error Thanks @krlmlr
Thanks for the patience / gave it a shot. Let me know if anything looks suspect. |
#Conflicts: # NEWS.md
@@ -36,10 +36,11 @@ odbc_write_table <- function(conn, | |||
overwrite = FALSE, | |||
append = FALSE, | |||
temporary = FALSE, | |||
row.names = NA, | |||
row.names = NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will fix #737
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pulled and confirmed it does. :)
Closes #737. |
@@ -35,9 +37,6 @@ | |||
* SQL Server: correctly enumerate schemas across databases in connections pane | |||
(@detule, #527). | |||
|
|||
* SQL Server: now uses column type `"BIGINT"` integer64 objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@detule I think you deleted this accidentally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh - sorry about that! Will fix tonight, unless someone beats me to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me do it since I'm polishing news for release.
Add news bullet accidentally dropped in #691
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, great! Do we still need the custom dbWriteTable()
implementation?
if (batch_rows == 0) { | ||
batch_rows <- 1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this condition can ever be TRUE
, with the check in line 137 in this PR.
return(NULL) | ||
}) | ||
|
||
if (nrow(value) > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps worth rephrasing as
out <- invisible(NA_real_)
if (nrow(value) == 0) {
return(out)
}
to avoid the indent?
Hi -
This is a performance enhancement when using
dbAppendTable
.We have seen recently that calls to
dbExistsTable
can be costly. Avoid calling it twice when using thedbAppendTable
API.