Skip to content

Connecting to the database

Before accessing the database, you need to set up the connection to it. The database is currently set up on a local machine (Aimées computer). Hoever, a .zip file of the database is available on the cluster and can be set up on a local machine or on the cluster for temporary use.

The database is set up using MySQL and all functionalities are accessed through a developed python package. The database package should be properly installed in a conda environment so all dependancies are met. The database package is located in the folder the package is called chinko_data_management.

Original Database

this is the database on Aimées computer. It is only accessible to through her account or the ctdatamanager account. Consult members from the wegmann lab for access to the account.

Once you have access to the computer, you can access the database using the following information:

open python in the conda environment where the database package is installed and run the following code:

#import necessary functions from the database package
from chinko_data_management.database import (initDatabaseConnection,
                                             getEngine,
                                             getSession, 
                                             initSessionAndEngine,
                                             )

#define log in information
DB_USER = "databaseUser"
DB_PASS = "GoodPassword"
DB_HOST = "localhost"
DB_PORT = 3306
DB_NAME = "chinkoCamTrapData"


#start connection
initDatabaseConnection(DB_USER,DB_PASS,DB_HOST,DB_NAME)
initSessionAndEngine(getSession(), getEngine())

from then on a session is open and you can access the database through the package.

example to get all images in the database:

#import table you wish to access
from chinko_data_management.database import T_Images

#use class functions
allImages = T_Images.getAll()

Cluster

Status 7.10.2026:

We have requested for the database to be set up on the cluster. This is still in progress and will be updated here when it is ready.