Description Usage Arguments Value Examples
Metadata about database objects
For the PrestoResult
object, the implementation
returns the additional stats
field which can be used to
implement things like progress bars. See the examples section.
1 2 3 4 5 6 7 8 | ## S4 method for signature 'PrestoDriver'
dbGetInfo(dbObj)
## S4 method for signature 'PrestoConnection'
dbGetInfo(dbObj)
## S4 method for signature 'PrestoResult'
dbGetInfo(dbObj)
|
dbObj |
A |
[PrestoResult] A list
with elements
The SQL sent to the database
Number of rows fetched so far
Whether all data has been fetched
Current stats on the query
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
conn <- dbConnect(Presto(), 'localhost', 7777, 'onur', 'datascience')
result <- dbSendQuery(conn, 'SELECT * FROM jonchang_iris')
iris <- data.frame()
progress.bar <- NULL
while (!dbHasCompleted(result)) {
chunk <- dbFetch(result)
if (!NROW(iris)) {
iris <- chunk
} else if (NROW(chunk)) {
iris <- rbind(iris, chunk)
}
stats <- dbGetInfo(result)[['stats']]
if (is.null(progress.bar)) {
progress.bar <- txtProgressBar(0, stats[['totalSplits']], style=3)
} else {
setTxtProgressBar(progress.bar, stats[['completedSplits']])
}
}
close(progress.bar)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.