Package: dittodb 0.1.8

Jonathan Keane

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:Jonathan Keane [aut, cre], Mauricio Vargas [aut], Helen Miller [rev], Etienne Racine [rev]

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://ropensci.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/ropensci/dittodb/issues

On CRAN:

52 exports 80 stars 4.01 score 6 dependencies 508 downloads

Last updated 2 months agofrom:97520b2d8874091743eb6183badbb7a45dd070e6 (via main)

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

Dependencies:cliDBIdigestgluelifecyclerlang

Developing dittodb

Rendered fromdeveloping-dittodb.Rmdusingknitr::rmarkdownon Jun 07 2024.

Last update: 2024-04-09
Started: 2020-05-03

Getting Started with dittodb

Rendered fromdittodb.Rmdusingknitr::rmarkdownon Jun 07 2024.

Last update: 2024-04-09
Started: 2020-04-24

nycflights13 data

Rendered fromnycflights.Rmdusingknitr::rmarkdownon Jun 07 2024.

Last update: 2024-04-09
Started: 2020-01-14

Readme and manuals

Help Manual

Help pageTopics
Capture and record database transactions and save them as mockscapture_db_requests capture_requests start_db_capturing stop_db_capturing
Detect if a specific SQL statement is sentexpect_sql
Methods for interacting with DB mocks instead of an actual databasedbBegin,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 databasemockdb start_mock_db stop_mock_db with_mock_db
An SQLite connection to a subset of nycflights13nycflights_sqlite
Create a standardised database for testingnycflights13_create_sql
Create an in-memory SQLite database for testingnycflights13_create_sqlite
Redact columns from a dataframe with the default redactorsredact_columns
Set 'dittodb''s debug levelset_dittodb_debug_level
Use 'dittodb' in your testsuse_dittodb
Run the DBI queries in an alternate mock directorywith_mock_path