Comments (7)
The argument can't be named n
because there's a conflict with name
:
f <- function(name, ..., n = NULL) {
tibble::lst(name, ..., n)
}
f("a")
#> $name
#> [1] "a"
#>
#> $n
#> NULL
f(n = "a")
#> Error in eval_tidy(xs[[i]], unique_output): argument "name" is missing, with no default
f(name = "a")
#> $name
#> [1] "a"
#>
#> $n
#> NULL
Created on 2019-08-23 by the reprex package (v0.3.0)
Going for max_rows
and establishing consistency in r-dbi/DBI#235.
from dbi3.
Scratch that: n
seems perfectly fine. Still need to understand why the first implementation attempt in RSQLite failed.
f <- function(name, ..., n = NULL) {
tibble::lst(name, ..., n)
}
f("b")
#> $name
#> [1] "b"
#>
#> $n
#> NULL
f(n = "a")
#> Error in eval_tidy(xs[[i]], unique_output): argument "name" is missing, with no default
f("b", n = "a")
#> $name
#> [1] "b"
#>
#> $n
#> [1] "a"
f(n = "a", "b")
#> $name
#> [1] "b"
#>
#> $n
#> [1] "a"
Created on 2019-09-23 by the reprex package (v0.3.0)
from dbi3.
The problem is partial matching of arguments for backends that don't implement the n
argument yet:
library(tibble)
f <- function(name, ...) {
lst(name, ...)
}
f(3, 1)
#> $name
#> [1] 3
#>
#> $`1`
#> [1] 1
f(1, name = 3)
#> $name
#> [1] 3
#>
#> $`1`
#> [1] 1
# Bad
f(1, n = 3)
#> $name
#> [1] 3
#>
#> $`1`
#> [1] 1
Created on 2019-09-23 by the reprex package (v0.3.0)
from dbi3.
Can solve by declaring the n
argument before the ellipsis in the dbReadTable()
generic.
from dbi3.
Backends probably want to override this to include LIMIT n
or TOP n
in the query.
from dbi3.
Postponing, because if we limit rows we also might want to limit columns. This functionality already exists in much better form in dbplyr and other packages.
from dbi3.
The "first n rows" isn't usually a good criterion because the data is returned in an order decided by the server.
from dbi3.
Related Issues (20)
- Test for formals(dbXxx) ineffective
- Specify and test case-sensitivity for table names
- Name collision when creating tables
- Avoid hard-coded data types in queries HOT 1
- Support passing lists as arguments for queries like `SELECT a, b WHERE a IN ($1)` HOT 5
- Support arrays natively HOT 15
- Stronger guarantees for quoting literals
- Reading and writing tables with dots in name
- Rethink `immediate` argument
- Arrow/Flight SQL
- How to run tests on a user's database?
- Feature Request: Virtual connection HOT 2
- Add default dbWriteTable() method HOT 2
- Specify limits per connection or per driver
- How to create an external table in Hive? HOT 1
- Reconnection
- `dbQuoteIdentifier` should validate SQL inputs HOT 1
- Streaming multiple statements in a single dbExecute/dbQuery/etc. call HOT 1
- Default connection
- Optionally return tibbles
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbi3.