Package: dittodb 0.1.8
dittodb: A Test Environment for Database Requests
Testing and documenting code that communicates with remote databases can be painful. Although the interaction with R is usually relatively simple (e.g. data(frames) passed to and from a database), because they rely on a separate service and the data there, testing them can be difficult to set up, unsustainable in a continuous integration environment, or impossible without replicating an entire production cluster. This package addresses that by allowing you to make recordings from your database interactions and then play them back while testing (or in other contexts) all without needing to spin up or have access to the database your code would typically connect to.
Authors:
dittodb_0.1.8.tar.gz
dittodb_0.1.8.zip(r-4.5)dittodb_0.1.8.zip(r-4.4)dittodb_0.1.8.zip(r-4.3)
dittodb_0.1.8.tgz(r-4.4-any)dittodb_0.1.8.tgz(r-4.3-any)
dittodb_0.1.8.tar.gz(r-4.5-noble)dittodb_0.1.8.tar.gz(r-4.4-noble)
dittodb_0.1.8.tgz(r-4.4-emscripten)dittodb_0.1.8.tgz(r-4.3-emscripten)
dittodb.pdf |dittodb.html✨
dittodb/json (API)
NEWS
# Install 'dittodb' in R: |
install.packages('dittodb', repos = c('https://packages.ropensci.org', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/ropensci/dittodb/issues
Last updated 6 months agofrom:97520b2d88 (on main). Checks:OK: 5 NOTE: 2. Indexed: yes.
Target | Result | Date |
---|---|---|
Doc / Vignettes | OK | Sep 27 2024 |
R-4.5-win | NOTE | Sep 27 2024 |
R-4.5-linux | NOTE | Sep 27 2024 |
R-4.4-win | OK | Sep 27 2024 |
R-4.4-mac | OK | Sep 27 2024 |
R-4.3-win | OK | Sep 27 2024 |
R-4.3-mac | OK | Sep 27 2024 |
Exports:.db_mock_paths.dittodb_envcapture_db_requestscheck_db_pathcheck_for_pkgclean_statementdb_mock_pathsdb_path_sanitizedbBegindbClearResultdbColumnInfodbCommitdbDisconnectdbExistsTabledbFetchdbGetInfodbGetQuerydbGetRowsAffecteddbHasCompleteddbListFieldsdbListTablesdbMockConnectdbQuoteIdentifierdbQuoteStringdbRemoveTabledbRollbackdbSendQuerydbSendStatementdbWriteTabledittodb_debug_levelexpect_sqlfetchget_dbnameget_redactorget_typehashhash_db_objectmake_pathnycflights_sqlitenycflights13_create_sqlnycflights13_create_sqliteredact_columnssanitize_table_idserialize_bit64set_dittodb_debug_levelstart_db_capturingstart_mock_dbstop_db_capturingstop_mock_dbuse_dittodbwith_mock_dbwith_mock_path
Developing dittodb
Rendered fromdeveloping-dittodb.Rmd
usingknitr::rmarkdown
on Sep 27 2024.Last update: 2024-04-09
Started: 2020-05-03
Getting Started with dittodb
Rendered fromdittodb.Rmd
usingknitr::rmarkdown
on Sep 27 2024.Last update: 2024-04-09
Started: 2020-04-24
nycflights13 data
Rendered fromnycflights.Rmd
usingknitr::rmarkdown
on Sep 27 2024.Last update: 2024-04-09
Started: 2020-01-14
Readme and manuals
Help Manual
Help page | Topics |
---|---|
Capture and record database transactions and save them as mocks | capture_db_requests capture_requests start_db_capturing stop_db_capturing |
Detect if a specific SQL statement is sent | expect_sql |
Methods for interacting with DB mocks instead of an actual database | dbBegin,DBIMockConnection-method dbClearResult,DBIMockResult-method dbColumnInfo,DBIMockResult-method dbCommit,DBIMockConnection-method dbDisconnect,DBIMockConnection-method dbExistsTable,DBIMockConnection,character-method dbExistsTable,DBIMockConnection,Id-method dbFetch,DBIMockResult-method dbGetInfo,DBIMockConnection-method dbGetInfo,DBIMockResult-method dbGetQuery,DBIMockRPostgreSQLConnection,character-method dbGetRowsAffected,DBIMockResult-method dbHasCompleted,DBIMockResult-method DBIMockConnection-class DBIMockResult-class dbListFields,DBIMockConnection,ANY-method dbListFields,DBIMockConnection,character-method dbListFields,DBIMockConnection,Id-method dbListTables,DBIMockConnection-method dbMockConnect dbQuoteIdentifier,DBIMockRPostgresConnection,character-method dbQuoteIdentifier,DBIMockRPostgresConnection,SQL-method dbQuoteString,DBIMockMariaDBConnection,character-method dbQuoteString,DBIMockMariaDBConnection,SQL-method dbQuoteString,DBIMockRPostgresConnection,character-method dbQuoteString,DBIMockRPostgresConnection,SQL-method dbRemoveTable,DBIMockConnection,character-method dbRollback,DBIMockConnection-method dbSendQuery,DBIMockConnection,character-method dbSendQuery,DBIMockConnection,SQL-method dbSendStatement,DBIMockConnection,character-method dbWriteTable,DBIMockConnection,character,data.frame-method fetch,DBIMockResult,ANY-method fetch,DBIMockResult,missing-method fetch,DBIMockResult-method mock-db-methods |
Run DBI queries against a mocked database | mockdb start_mock_db stop_mock_db with_mock_db |
An SQLite connection to a subset of nycflights13 | nycflights_sqlite |
Create a standardised database for testing | nycflights13_create_sql |
Create an in-memory SQLite database for testing | nycflights13_create_sqlite |
Redact columns from a dataframe with the default redactors | redact_columns |
Set 'dittodb''s debug level | set_dittodb_debug_level |
Use 'dittodb' in your tests | use_dittodb |
Run the DBI queries in an alternate mock directory | with_mock_path |