r-dbi / dbitest Goto Github PK
View Code? Open in Web Editor NEWTesting DBI drivers
Home Page: http://dbitest.r-dbi.org
License: GNU Lesser General Public License v2.1
Testing DBI drivers
Home Page: http://dbitest.r-dbi.org
License: GNU Lesser General Public License v2.1
After r-dbi/DBI#42.
Use on.exit(try(...))
or on.exit(expect_error(...))
.
for simplicity.
to cover the SQL -> DB -> SQL -> R path.
Just to be sure.
Preference over skip list. For TDD.
Combine with error testing, in particular invalid arguments
where appropriate.
DBI
is LGPL-2 licensed, probably for a reason. Should we allow using (linking) the package with proprietary code?
Tests available in RSQLite.
Some tests may require configuration:
Via tweaks
argument to make_context()
.
dbQuoteIdentifier() should not be: r-dbi/DBI#24.
dbQuoteString() should.
Just a reminder to myself.
-> NULL
See r-dbi/RSQLite#38.
as soon as it hits CRAN: https://github.com/metacran/description.
To avoid devtools dependency.
Current tests test only one data type at a time. Add tests for using different types at once (only basic types).
SELECT cast(NULL as <dbDataType()>) AS a
Related to NSE.
@jimhester: Do you see a way to make lintr happy with the with_connection
function in this package? Install branch using devtools::install_github("krlmlr/DBItest@feature/result")
. Thanks a lot for your input!
for the existing backends.
Example: Invalid connection, invalid result set, ...
Outside of test_...() framework -- needs to load and unload the backend package.
from the skip lists of the existing backends.
Move/copy testing-related stuff from DBI backend vignette.
34: on.exit(expect_error(dbClearResult(res), NA), add = TRUE)
I guess it should be
on.exit(expect_true(dbClearResult(res), NA), add = TRUE)
Linking to vignette.
Think about data type mapping.
res <- dbSendQuery(con, sql)
dbBind(res, list(...))
data <- dbFetch(res)
# dbClearResult(res) # no clearing of result here
dbBind(res, list(...))
data <- dbFetch(res)
dbClearResult(res)
Missing in proposal.
in DBI project.
all tests are mentioned, missing parts of the DBI are added
Include dbListFields()
You don’t have admin rights to rstats-db
Problem: on.exit
appends new handlers, instead of prepending them (which would be better for most use cases). Code like
con <- connect(ctx)
on.exit(dbDisconnect(con), add = TRUE)
res <- dbSendQuery(con, "SELECT 1")
on.exit(dbClearResult(res), add = TRUE)
issues warnings that a connection is closed while result sets are still open. Something like the following might be better:
with_connection({
res <- dbSendQuery(con, "SELECT 1")
on.exit(dbClearResult(res), add = TRUE)
})
Ensure that all lines covered by master are covered after removing the tests.
Hi Kirill et all,
I am facing issues in test_result that derive form differences among SQL dialects:
dbSendQuery composes a (temporary) table in the DB, thus SELECT 1
becomes CREATE TABLE xy_temp AS (SELECT 1)
. This works for postgres, but e.g. EXASOL and Oracle need a column alias, i.e. SELECT 1 as a
or SELECT 1 as "1"
(quoted identifier needed for the first char is numeric)
Oracle does not get along with SELECT without FROM stmt, it would need e.g. SELECT 1 AS a FROM dual
. EXASOL gets along without, except for in combination with a WHERE clause.
While almost any DBMS should not have problems if col aliases were added, but the dummy table "dual" does not exist everywhere. One option would be to add a parameter to define the table to use. Another would be to have the script create a table in the DBMS before the test and drop it on exit.
My opinion is that that general approach should be to avoid parameters whenever possible (there might be other dialect related issues, adding parameters for everything would cause confusion). Thus I prefer the writing of a table for the test.
Cheers,
Marcel
for r-dbi/RMySQL#125.
for stress tests.
Related: #39.
to test doc, as \code{\link[DBI]{db}}
What is the reason for deprecating them?
Related: r-dbi/DBI#18
Trouble opening new R session from R CMD check
. @hadley: What's the best way to do this?
if already disconnected/closed.
after CRAN release of DBI.
SQLite only.
if package is loaded via load_all. Probably no issue for R CMD check.
and naming of the test_()
functions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.