Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.23 KB

database.rst

File metadata and controls

44 lines (29 loc) · 1.23 KB

Directly Querying the Database

ImmuneDB is backed by a MySQL database that can be queried directly to gather information, bypassing the Python API.

Accessing the Database

There are many ways to access the database directly. The two introduced here are directly through MySQL or using immunedb_sql which simply wraps a call to MySQL.

With the immunedb_sql wrapper (recommended)

$ immunedb_sql PATH_TO_CONFIG

This is entirely equivalent to using mysql and will drop to the MySQL interpreter. You can also pass a query directly from the command line. For example:

$ immunedb_sql PATH_TO_CONFIG --query 'select * from samples'

Directly with MySQL

From the command line, you may access an ImmuneDB database DATABASE from user USERNAME with:

$ mysql -u USERNAME -p DATABASE

This will prompt for a password and then to the database. This method of access is useful for quickly querying the database. To save results of a query QUERY run the command:

$ mysql -u USERNAME -p DATABASE -e "QUERY" > output