... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
Package: SQLDataFrame |
2 | 2 |
Title: Representation of SQL database in DataFrame metaphor |
3 |
-Version: 1.10.0 |
|
3 |
+Version: 1.10.1 |
|
4 | 4 |
Authors@R: c( |
5 | 5 |
person("Qian", "Liu", email = "qian.liu@roswellpark.org", role = c("aut", "cre"), |
6 | 6 |
comment = c(ORCID = "0000-0003-1456-5099")), |
... | ... |
@@ -296,11 +296,11 @@ setGeneric("dbtable", signature = "x", function(x) |
296 | 296 |
|
297 | 297 |
setMethod("dbtable", "SQLDataFrame", function(x) |
298 | 298 |
{ |
299 |
- op <- tblData(x)$ops |
|
300 |
- if (! is(op, "op_double")) { |
|
299 |
+ op <- tblData(x)$lazy_query |
|
300 |
+ if (! is(op, "lazy_set_op_query")) { |
|
301 | 301 |
out1 <- op$x |
302 | 302 |
repeat { |
303 |
- if (is(out1, "op_double")) { |
|
303 |
+ if (is(out1, "lazy_set_op_query")) { |
|
304 | 304 |
return(message(.msg_dbtable)) |
305 | 305 |
} else if (is.ident(out1)) break |
306 | 306 |
out1 <- out1$x |
... | ... |
@@ -370,8 +370,8 @@ select.SQLDataFrame <- function(.data, ...) |
370 | 370 |
{ |
371 | 371 |
tbl <- .extract_tbl_from_SQLDataFrame_indexes(tblData(.data), .data) |
372 | 372 |
dots <- quos(...) |
373 |
- old_vars <- op_vars(tbl$ops) |
|
374 |
- new_vars <- tidyselect::vars_select(old_vars, !!!dots, .include = op_grps(tbl$ops)) |
|
373 |
+ old_vars <- op_vars(tbl$lazy_query) |
|
374 |
+ new_vars <- tidyselect::vars_select(old_vars, !!!dots, .include = op_grps(tbl$lazy_query)) |
|
375 | 375 |
.extractCOLS_SQLDataFrame(.data, new_vars) |
376 | 376 |
} |
377 | 377 |
|
... | ... |
@@ -59,7 +59,7 @@ saveSQLDataFrame <- function(x, |
59 | 59 |
db_sql_render(con, tbl), con = con) |
60 | 60 |
dbExecute(con, sql_cmd) |
61 | 61 |
} else { |
62 |
- if (is(tblData(x)$ops, "op_double")) ## from "*_join" or "union", etc |
|
62 |
+ if (is(tblData(x)$lazy_query, "op_double")) ## from "*_join" or "union", etc |
|
63 | 63 |
stop("Saving SQLDataFrame with lazy join / union queries ", |
64 | 64 |
"from same non-writable MySQL database is not supported!") |
65 | 65 |
if (!.mysql_has_write_perm(localConn)) |
... | ... |
@@ -88,14 +88,14 @@ saveSQLDataFrame <- function(x, |
88 | 88 |
stop("The 'dbname' already exists! Please provide a new value ", |
89 | 89 |
"OR change 'overwrite = TRUE'. ") |
90 | 90 |
} |
91 |
- if (is(tblData(x)$ops, "op_base") ) { |
|
91 |
+ if (is(tblData(x)$lazy_query, "lazy_base_query")) { |
|
92 | 92 |
con <- DBI::dbConnect(dbDriver("SQLite"), dbname = dbname) |
93 | 93 |
aux <- .attach_database(con, connSQLDataFrame(x)@dbname) |
94 | 94 |
tbl <- .open_tbl_from_connection(con, aux, x) ## already |
95 | 95 |
## evaluated |
96 | 96 |
## ridx |
97 | 97 |
## here. |
98 |
- } else if (is(tblData(x)$ops, "op_double") | is(tblData(x)$ops, "op_single")) { |
|
98 |
+ } else if (is(tblData(x)$lazy_query, "lazy_set_op_query")) { |
|
99 | 99 |
con <- connSQLDataFrame(x) |
100 | 100 |
tbl <- tblData(x) |
101 | 101 |
## Since the "*_join", "union" function returns @indexes |
... | ... |
@@ -120,7 +120,7 @@ saveSQLDataFrame <- function(x, |
120 | 120 |
|
121 | 121 |
## This chunk applies to an input SQLDataFrame from "rbind" |
122 | 122 |
if (is(con, "SQLiteConnection")) { |
123 |
- if(is(tblData(x)$ops, "op_double") | is(tblData(x)$ops, "op_single")) { |
|
123 |
+ if(is(tblData(x)$lazy_query, "lazy_set_op_query")) { |
|
124 | 124 |
file.copy(connSQLDataFrame(x)@dbname, dbname, overwrite = overwrite) |
125 | 125 |
sql_drop <- build_sql("DROP TABLE ", sql(dbtable), con = con) |
126 | 126 |
dbExecute(con, sql_drop) |
... | ... |
@@ -38,11 +38,11 @@ |
38 | 38 |
|
39 | 39 |
.join_union_prepare_sqlite <- function(x, y) |
40 | 40 |
{ |
41 |
- if (is(tblData(x)$ops, "op_double") | is(tblData(x)$ops, "op_single")) { |
|
42 |
- ## may change: !is(tblData(x)$ops, "op_base") |
|
41 |
+ if (is(tblData(x)$lazy_query, "lazy_set_op_query")) { |
|
42 |
+ ## may change: !is(tblData(x)$lazy_query, "lazy_base_query") |
|
43 | 43 |
con <- connSQLDataFrame(x) |
44 | 44 |
tblx <- .open_tbl_from_connection(con, "main", x) |
45 |
- if (is(tblData(y)$ops, "op_double") | is(tblData(y)$ops, "op_single")) { |
|
45 |
+ if (is(tblData(x)$lazy_query, "lazy_set_op_query")) { |
|
46 | 46 |
## attach all databases from y except "main", which is |
47 | 47 |
## temporary connection from "union" or "join" |
48 | 48 |
dbs <- .dblist(con) |
... | ... |
@@ -63,7 +63,7 @@ |
63 | 63 |
} else { |
64 | 64 |
tbly <- .attachMaybe_and_open_tbl_in_new_connection(con, y) |
65 | 65 |
} |
66 |
- } else if (is(tblData(y)$ops, "op_double") | is(tblData(y)$ops, "op_single")) { |
|
66 |
+ } else if (is(tblData(x)$lazy_query, "lazy_set_op_query")) { |
|
67 | 67 |
con <- connSQLDataFrame(y) |
68 | 68 |
tbly <- .open_tbl_from_connection(con, "main", y) |
69 | 69 |
tblx <- .attachMaybe_and_open_tbl_in_new_connection(con, x) |
... | ... |
@@ -7,7 +7,7 @@ author: |
7 | 7 |
affiliation: Roswell Park Comprehensive Cancer Center, Buffalo, NY |
8 | 8 |
date: "last compiled: `r Sys.Date()`" |
9 | 9 |
output: |
10 |
- BiocStyle::html_document: |
|
10 |
+ rmarkdown::html_document: |
|
11 | 11 |
toc: true |
12 | 12 |
toc_float: true |
13 | 13 |
package: SQLDataFrame |
... | ... |
@@ -23,7 +23,7 @@ knitr::opts_chunk$set( |
23 | 23 |
comment = "#>" |
24 | 24 |
) |
25 | 25 |
``` |
26 |
-date: "last edit: 9/30/2019" |
|
26 |
+date: "last edit: 9/21/2022" |
|
27 | 27 |
|
28 | 28 |
[dbplyr]: https://cran.r-project.org/web/packages/dbplyr/index.html |
29 | 29 |
|