Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative to using SQLite in testing tools #37

Open
ChemiKyle opened this issue Feb 25, 2022 · 1 comment
Open

Alternative to using SQLite in testing tools #37

ChemiKyle opened this issue Feb 25, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request hold

Comments

@ChemiKyle
Copy link
Contributor

ChemiKyle commented Feb 25, 2022

While REDCap uses MySQL/MariaDB, we've used an in-memory SQLite database for ease of use in testing

conn <- dbConnect(RSQLite::SQLite(), dbname = ":memory:")

Syntax mismatches have already complicated schemas and are now making porting existing functions difficult (#12 (comment)).

I'm looking into seeing if we can stand up a MariaDB database entirely in memory to avoid the need for local or containerized solutions. Another alternative may be to port all SQL commands to R equivalents and let DBI handle the command fabrication.

RAM MariaDB

Ideally we would be able to create an entirely in-memory MariaDB instance, this unfortunately is not as simple as dbConnect(RMariaDB::MariaDB(), dbname = ":memory:").

It appears MariaDB supports in-memory tables (see: https://stackoverflow.com/a/54849686/7418735 and https://mariadb.com/kb/en/memory-storage-engine/).

@ChemiKyle ChemiKyle added the enhancement New feature or request label Feb 25, 2022
@ChemiKyle ChemiKyle self-assigned this Feb 25, 2022
@pbchase pbchase added the hold label May 13, 2022
@pbchase
Copy link
Contributor

pbchase commented Nov 21, 2023

I have been using duckdb for this purpose. it's data types are richer than SQLite and closer to MySQL's. I did a lot of this conversion in PR #143 and is eliminated 4 long-standing intermittent test failures. They were all caused by sqlite DBs accidentally appear on disk instead of in memory. Running library(dotenv) would change the sqlite behavior and tests would persist data on disk, then read it, and trip up on the unexpected database content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hold
Projects
None yet
Development

No branches or pull requests

2 participants