Swap RMySQL for RMariaDB
parent
5baaa94092
commit
9a02e93b25
|
@ -1,21 +1,35 @@
|
||||||
# Virtual Environments
|
## Python Virtual Environment
|
||||||
|
|
||||||
## Add new packages
|
### Add new packages
|
||||||
|
|
||||||
Try to install any new package using `conda`. If a package is not available in one of `conda`'s channels you can install it with `pip` but make sure your virtual environment is active.
|
Try to install any new package using `conda install -c CHANNEL PACKAGE_NAME` (you can use `pip` if the package is only available there). Make sure your Python virtual environment is active (`conda activate YOUR_ENV`).
|
||||||
|
|
||||||
## Update your conda `environment.yaml`
|
### Remove packages
|
||||||
|
Uninstall packages using the same manager you used to install them `conda remove PACKAGE_NAME` or `pip uninstall PACKAGE_NAME`
|
||||||
|
|
||||||
After installing a new package you can use the following command in your terminal to update your `environment.yaml` before publishing your pipeline. Note that we ignore the package version for `libfortran` to keep compatibility with Linux:
|
### Update your conda `environment.yaml`
|
||||||
|
|
||||||
|
After installing or removing a package you can use the following command in your terminal to update your `environment.yaml` before publishing your pipeline. Note that we ignore the package version for `libfortran` to keep compatibility with Linux:
|
||||||
```bash
|
```bash
|
||||||
conda env export --no-builds | sed 's/^.*libgfortran.*$/ - libgfortran/' > environment.yml
|
conda env export --no-builds | sed 's/^.*libgfortran.*$/ - libgfortran/' > environment.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Update and prune your conda environment from a `environment.yaml` file
|
## R Virtual Environment
|
||||||
|
|
||||||
Execute the following command in your terminal, see these docs for more [information](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#updating-an-environment)
|
### Add new packages
|
||||||
|
1. Open your terminal and navigate to RAPIDS' root folder
|
||||||
|
2. Run `R` to open an R interactive session
|
||||||
|
3. Run `renv::install("PACKAGE_NAME")`
|
||||||
|
|
||||||
|
### Remove packages
|
||||||
|
1. Open your terminal and navigate to RAPIDS' root folder
|
||||||
|
2. Run `R` to open an R interactive session
|
||||||
|
3. Run `renv::remove("PACKAGE_NAME")`
|
||||||
|
|
||||||
|
### Update your R `renv.lock`
|
||||||
|
After installing or removing a package you can use the following command in your terminal to update your `renv.lock` before publishing your pipeline.
|
||||||
|
|
||||||
|
1. Open your terminal and navigate to RAPIDS' root folder
|
||||||
|
2. Run `R` to open an R interactive session
|
||||||
|
3. Run `renv::snapshot()` (renv will ask you to confirm any updates to this file)
|
||||||
|
|
||||||
```bash
|
|
||||||
conda env update --prefix ./env --file environment.yml --prune
|
|
||||||
```
|
|
||||||
|
|
22
renv.lock
22
renv.lock
|
@ -86,12 +86,12 @@
|
||||||
"Repository": "CRAN",
|
"Repository": "CRAN",
|
||||||
"Hash": "e031418365a7f7a766181ab5a41a5716"
|
"Hash": "e031418365a7f7a766181ab5a41a5716"
|
||||||
},
|
},
|
||||||
"RMySQL": {
|
"RMariaDB": {
|
||||||
"Package": "RMySQL",
|
"Package": "RMariaDB",
|
||||||
"Version": "0.10.20",
|
"Version": "1.0.10",
|
||||||
"Source": "Repository",
|
"Source": "Repository",
|
||||||
"Repository": "CRAN",
|
"Repository": "CRAN",
|
||||||
"Hash": "022066398851453f187950137e21daad"
|
"Hash": "d149479ea03e5cbb1e788449ef5e04b4"
|
||||||
},
|
},
|
||||||
"Rcpp": {
|
"Rcpp": {
|
||||||
"Package": "Rcpp",
|
"Package": "Rcpp",
|
||||||
|
@ -156,6 +156,20 @@
|
||||||
"Repository": "CRAN",
|
"Repository": "CRAN",
|
||||||
"Hash": "543776ae6848fde2f48ff3816d0628bc"
|
"Hash": "543776ae6848fde2f48ff3816d0628bc"
|
||||||
},
|
},
|
||||||
|
"bit": {
|
||||||
|
"Package": "bit",
|
||||||
|
"Version": "4.0.4",
|
||||||
|
"Source": "Repository",
|
||||||
|
"Repository": "CRAN",
|
||||||
|
"Hash": "f36715f14d94678eea9933af927bc15d"
|
||||||
|
},
|
||||||
|
"bit64": {
|
||||||
|
"Package": "bit64",
|
||||||
|
"Version": "4.0.5",
|
||||||
|
"Source": "Repository",
|
||||||
|
"Repository": "CRAN",
|
||||||
|
"Hash": "9fe98599ca456d6552421db0d6772d8f"
|
||||||
|
},
|
||||||
"boot": {
|
"boot": {
|
||||||
"Package": "boot",
|
"Package": "boot",
|
||||||
"Version": "1.3-24",
|
"Version": "1.3-24",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
source("renv/activate.R")
|
source("renv/activate.R")
|
||||||
|
|
||||||
library(RMySQL)
|
library(RMariaDB)
|
||||||
library(stringr)
|
library(stringr)
|
||||||
library(purrr)
|
library(purrr)
|
||||||
library(readr)
|
library(readr)
|
||||||
|
@ -19,7 +19,7 @@ fitbit_ignored = config$FITBIT_SECTION$IGNORED_DEVICE_IDS
|
||||||
rmysql.settingsfile <- "./.env"
|
rmysql.settingsfile <- "./.env"
|
||||||
|
|
||||||
if(config$SOURCE$TYPE == "AWARE_DEVICE_TABLE"){
|
if(config$SOURCE$TYPE == "AWARE_DEVICE_TABLE"){
|
||||||
database <- dbConnect(MySQL(), default.file = rmysql.settingsfile, group = group)
|
database <- dbConnect(MariaDB(), default.file = rmysql.settingsfile, group = group)
|
||||||
if(config$FITBIT_SECTION$ADD == TRUE){
|
if(config$FITBIT_SECTION$ADD == TRUE){
|
||||||
query <- paste("SELECT",phone_device_id_column, ",",fitbit_device_id_column," as _temp_fitbit_id, brand, label, timestamp FROM aware_device order by timestamp asc")
|
query <- paste("SELECT",phone_device_id_column, ",",fitbit_device_id_column," as _temp_fitbit_id, brand, label, timestamp FROM aware_device order by timestamp asc")
|
||||||
fitbit_device_id_column <- "_temp_fitbit_id"
|
fitbit_device_id_column <- "_temp_fitbit_id"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
source("renv/activate.R")
|
source("renv/activate.R")
|
||||||
library(RMySQL)
|
library(RMariaDB)
|
||||||
library("dplyr", warn.conflicts = F)
|
library("dplyr", warn.conflicts = F)
|
||||||
library(readr)
|
library(readr)
|
||||||
library(stringr)
|
library(stringr)
|
||||||
|
@ -23,7 +23,7 @@ unified_device_id <- tail(device_ids, 1)
|
||||||
# As opposed to phone data, we dont' filter by date here because data can still be in JSON format, we need to parse it first
|
# As opposed to phone data, we dont' filter by date here because data can still be in JSON format, we need to parse it first
|
||||||
|
|
||||||
if(source$TYPE == "DATABASE"){
|
if(source$TYPE == "DATABASE"){
|
||||||
dbEngine <- dbConnect(MySQL(), default.file = "./.env", group = source$DATABASE_GROUP)
|
dbEngine <- dbConnect(MariaDB(), default.file = "./.env", group = source$DATABASE_GROUP)
|
||||||
query <- paste0("SELECT * FROM ", table, " WHERE ",source$DEVICE_ID_COLUMN," IN ('", paste0(device_ids, collapse = "','"), "')")
|
query <- paste0("SELECT * FROM ", table, " WHERE ",source$DEVICE_ID_COLUMN," IN ('", paste0(device_ids, collapse = "','"), "')")
|
||||||
sensor_data <- dbGetQuery(dbEngine, query)
|
sensor_data <- dbGetQuery(dbEngine, query)
|
||||||
dbDisconnect(dbEngine)
|
dbDisconnect(dbEngine)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
source("renv/activate.R")
|
source("renv/activate.R")
|
||||||
source("src/data/unify_utils.R")
|
source("src/data/unify_utils.R")
|
||||||
library(RMySQL)
|
library(RMariaDB)
|
||||||
library(stringr)
|
library(stringr)
|
||||||
library("dplyr", warn.conflicts = F)
|
library("dplyr", warn.conflicts = F)
|
||||||
library(readr)
|
library(readr)
|
||||||
|
@ -80,7 +80,7 @@ platforms <- participant$PHONE$PLATFORMS
|
||||||
validate_deviceid_platforms(device_ids, platforms)
|
validate_deviceid_platforms(device_ids, platforms)
|
||||||
timestamp_filter <- get_timestamp_filter(device_ids, participant, timezone)
|
timestamp_filter <- get_timestamp_filter(device_ids, participant, timezone)
|
||||||
|
|
||||||
dbEngine <- dbConnect(MySQL(), default.file = "./.env", group = group)
|
dbEngine <- dbConnect(MariaDB(), default.file = "./.env", group = group)
|
||||||
|
|
||||||
if(is_multiplaform_participant(dbEngine, device_ids, platforms)){
|
if(is_multiplaform_participant(dbEngine, device_ids, platforms)){
|
||||||
sensor_data <- unify_raw_data(dbEngine, table, sensor, timestamp_filter, aware_multiplatform_tables, device_ids, platforms)
|
sensor_data <- unify_raw_data(dbEngine, table, sensor, timestamp_filter, aware_multiplatform_tables, device_ids, platforms)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
source("renv/activate.R")
|
source("renv/activate.R")
|
||||||
library(RMySQL)
|
library(RMariaDB)
|
||||||
library("dplyr", warn.conflicts = F)
|
library("dplyr", warn.conflicts = F)
|
||||||
library(readr)
|
library(readr)
|
||||||
library(stringr)
|
library(stringr)
|
||||||
|
@ -14,7 +14,7 @@ sensor_file <- snakemake@output[[1]]
|
||||||
participant <- read_yaml(participant_file)
|
participant <- read_yaml(participant_file)
|
||||||
record_id <- participant$PHONE$LABEL
|
record_id <- participant$PHONE$LABEL
|
||||||
|
|
||||||
dbEngine <- dbConnect(MySQL(), default.file = "./.env", group = source$DATABASE_GROUP)
|
dbEngine <- dbConnect(MariaDB(), default.file = "./.env", group = source$DATABASE_GROUP)
|
||||||
query <- paste0("SELECT * FROM ", table, " WHERE record_id = '", record_id, "'")
|
query <- paste0("SELECT * FROM ", table, " WHERE record_id = '", record_id, "'")
|
||||||
sensor_data <- dbGetQuery(dbEngine, query)
|
sensor_data <- dbGetQuery(dbEngine, query)
|
||||||
dbDisconnect(dbEngine)
|
dbDisconnect(dbEngine)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
source("renv/activate.R")
|
source("renv/activate.R")
|
||||||
library(RMySQL)
|
library(RMariaDB)
|
||||||
library("dplyr", warn.conflicts = F)
|
library("dplyr", warn.conflicts = F)
|
||||||
library(readr)
|
library(readr)
|
||||||
library(stringr)
|
library(stringr)
|
||||||
|
@ -15,7 +15,7 @@ sensor_file <- snakemake@output[[1]]
|
||||||
participant <- read_yaml(participant_file)
|
participant <- read_yaml(participant_file)
|
||||||
record_id <- participant$PHONE$LABEL
|
record_id <- participant$PHONE$LABEL
|
||||||
|
|
||||||
dbEngine <- dbConnect(MySQL(), default.file = "./.env", group = source$DATABASE_GROUP)
|
dbEngine <- dbConnect(MariaDB(), default.file = "./.env", group = source$DATABASE_GROUP)
|
||||||
query <- paste0("SELECT * FROM ", table, " WHERE record_id = '", record_id, "'")
|
query <- paste0("SELECT * FROM ", table, " WHERE record_id = '", record_id, "'")
|
||||||
sensor_data <- dbGetQuery(dbEngine, query)
|
sensor_data <- dbGetQuery(dbEngine, query)
|
||||||
dbDisconnect(dbEngine)
|
dbDisconnect(dbEngine)
|
||||||
|
|
Loading…
Reference in New Issue