aboutsummaryrefslogtreecommitdiff
path: root/gn3/db_utils.py
AgeCommit message (Expand)Author
2024-06-14fix: typehints in index-genenetwork scriptJohn Nduli
2024-06-12refactor: add db_utils global logger that will be the defaultJohn Nduli
2024-06-12fix: log errors when an exception occurs due to db_utilsJohn Nduli
2023-09-05Remove un-necessary ellipsis...Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com> Munyoki Kilyungi
2023-08-18Commit on success, rollback on error.Frederick Muriuki Muriithi
2023-07-18Fix wrong import, and typing issues.Frederick Muriuki Muriithi
2023-04-15Decouple `gn3.db_utils` from `flask.current_app`....Decouple the `gn3.db_utils` module from the global `flask.current_app` object, ensuring that the database uri value is passed in as a required argument to the `gn3.db_utils.database_connection` function. Frederick Muriuki Muriithi
2023-04-06Remove deprecated `gn3.db_utils.database_connector` function...Remove the deprecated function and fix a myriad of bugs that arise from removing the function. Issue: https://issues.genenetwork.org/issues/bugfix_coupling_current_app_and_db_utils Frederick Muriuki Muriithi
2023-04-05Enable use of `database_connection` in scripts without current_app...There is need to run external scripts using the same configurations as the application but without the need to couple the script to the application. In this case, we provide the needed configuration directly in the CLI, and modify the existing `gn3.db_utils.database_connection` function to allow it to work coupled to the app or otherwise. Frederick Muriuki Muriithi
2023-03-23conf: use flask.current_app.config not in gn3.settings...The configuration in gn3.settings can (and does) get overwritten by values in the environment variable `GN3_CONF` and any configurations passed in the call to the `gn3.app.create_app` function; as such, this commit changes the configuration used in the code to user the final configuration values that are in the running application's `flask.current_app.config` object. Frederick Muriuki Muriithi
2023-02-23auth: Link data in MySQL to the groups (in SQLite)...In order for the group leaders (and other resource creators) to be able to link data to the resources, the data needs to be first linked to the relevant group. This commit enables the system admin to link the data in MySQL to the groups. Frederick Muriuki Muriithi
2022-11-02Fix pylint and mypy errors...* gn3/db/sample_data.py (get_trait_csv_sample_data): Pass __query directly to cursor.execute. Rename value to _value in for loop to make mypy pass. * gn3/db_utils.py (Connection): Add class docstring. (Connection.cursor): Add docstring. * mypy.ini: Add an entry for xapian. Munyoki Kilyungi
2022-10-28Use Xapian index path from app settings....App settings should be accessed from current_app. It should not be hard-coded to a variable in a module. * gn3/db_utils.py: Do not import XAPIAN_DB_PATH from gn3.settings. (xapian_database): Accept path argument. * gn3/api/search.py: Import current_app from flask. (search_results): Pass Xapian index path to xapian_database. Arun Isaac
2022-10-28Disable various pylint checks on Connection class....* gn3/db_utils.py (Connection): Disable missing-class-docstring, missing-function-docstring and too-few-public-methods pylint checks. Arun Isaac
2022-10-26Add xapian database connection context manager....* gn3/settings.py (XAPIAN_DB_PATH): New variable. * gn3/db_utils.py: Import xapian and XAPIAN_DB_PATH from gn3.settings. (xapian_database): New function. Arun Isaac
2022-10-18Add database connection context manager....* gn3/db_utils.py: Import contextlib. Import Any, Iterator, Protocol and Tuple from typing. (database_connector): Deprecate function. (Connection): New class. (database_connection): New function. Arun Isaac
2022-08-22Use non-default MySQL port if present...By default, MySQL/Mariadb connects at port 3306, however, the configuration variable `SQL_URI` could contain a different port. In that case, this commit allows the system to connect to the non-default port. Frederick Muriuki Muriithi
2022-03-11Fix some linting issuesFrederick Muriuki Muriithi
2022-03-08Create database connections within context managers...Use the `with` context manager to open database connections, so as to ensure that those connections are closed once the call is completed. This hopefully avoids the 'too many connections' error Frederick Muriuki Muriithi
2021-05-08gn3: db_utils: Remove mypy ignore stub...MySQLdb is already ignored in ".mypy.ini", added in 88c33df. BonfaceKilz
2021-05-08Fix pep-8 errorsBonfaceKilz
2021-04-12Integrate correlation API...- add new api for gn2-gn3 sample r integration - delete map for sample list to values - add db util file - add python msql-client dependency - add db for fetching lit correlation results - add unittests for db utils - add tests for db_utils - modify api for fetching lit correlation results - refactor Mock Database Connector and unittests - add sql url parser - add SQL URI env variable - refactor code for db utils - modify return data for lit correlation - refactor tissue correlation endpoint - replace db_instance with connAlexander Kabui