The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The goal of easydb is to simplify the process of connecting to databases using R
Install from CRAN
install.packages('easydb')
You can install the development version of easydb like so:
# install.packages('remotes')
::install_github('selkamand/easydb') remotes
library(easydb)
# Initialise a config file at '~/.easydb'
easydb_init(config_file = '~/.easydb')
# sqlite
<- system.file(package="easydb", "testdbs/mtcars.sqlite")
sqlitedb <- easydb_connect(sqlitedb, config_file = '~/.easydb')
sqlite_connection
# mysql
# Example: connect to the public rfam mysql database
#
# See here for connection configuration:
# https://docs.rfam.org/en/latest/database.html
<- easydb_connect(dbname = "Rfam", config_file = '~/.easydb')
rfam_connection
# postgresql
# Example: Connect to public RNAcentral postgres database
#
# See here for connection configuration:
# https://rnacentral.org/help/public-database
<- easydb_connect(dbname = 'pfmegrnargs', config_file = '~/.easydb')
rna_central_connection
# Don't forget to disconnect from databases when you finish!
easydb_disconnect(sqlite_connection)
easydb_disconnect(rna_central_connection)
easydb_disconnect(rfam_connection)
Once you’ve finished working with a database, its best to disconnect
from the db using easydb_disconnect(connection_object)
We need to store your configuration details in a file somewhere on disk. You can choose where.
A common practice is to create a hidden file in your home directory.
We’ll create our config file: ~/.easydb
easydb_init(config_file = '~/.easydb')
This only needs to be done once.
Connect to databases:
easydb_connect('database_name', '~/.easydb')
Disconnect from databases:
easydb_disconnect(connection)
The first time you try to connect to a database, you may have to answer some questions about the database (depending on the database type you’re connecting to).
Once you’ve setup the configuration, you will not have to re-enter
host/port/creds unless you set the argument
from_scratch = TRUE
. This argument will delete the existing
configuration and credentials for the given database and prompt you to
supply updated information.
# List previously configured databases
easydb_available_databases('~/.easydb')
Database configurations (host, port, driver, etc) are stored in a
configuration file that will be created at a user-specified location (we
recommend ~/.easydb
).
Credentials are stored separately in your operating systems
credential store. This is powered by keyring
. If you’re on
linux you may need to install the secret service library. See the readme for details
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.