Use SQLAlchemy to connect to the database #66

Closed
opened 2022-04-22 18:56:10 +02:00 by pfm · 2 comments
Collaborator

Overview

The script gpg-mailgate-web/cron.py uses MySQLdb package to access database. This makes it impossible to use other database backends.

We'd like Lacre to be more flexible and easier to test (e.g. by testing with an in-memory SQLite database).

Goals

  • Get rid of hardcoded MySQLdb references.
  • Use a framework like SQLAlchemy to access database.
  • Cover the cron script with tests.
  • Update sample configuration.

Documentation

# Overview The script `gpg-mailgate-web/cron.py` uses `MySQLdb` package to access database. This makes it impossible to use other database backends. We'd like Lacre to be more flexible and easier to test (e.g. by testing with an in-memory SQLite database). # Goals * Get rid of hardcoded `MySQLdb` references. * Use a framework like SQLAlchemy to access database. * Cover the cron script with tests. * Update sample configuration. # Documentation * [SQLAlchemy 1.4 core tutorial](https://docs.sqlalchemy.org/en/14/core/tutorial.html) * [SQLAlchemy "library"](https://www.sqlalchemy.org/library.html#reference) (reading materials, videos, etc.)
pfm added the
CODE
label 2022-04-22 19:20:14 +02:00
pfm added reference sqlalchemy 2022-04-22 19:20:28 +02:00
Author
Collaborator

We'll need to provide this link and an overview in the documentation, as well as the sample config: Engine configuration.

Also, we'll be able to replace the gpg-mailgate-web/schema.sql file with a script that would initialise the schema. Using a dedicated tool to set up the database would be easier than having to issue database commands manually, esp. if we want wide adoption.

We'll need to provide this link and an overview in the documentation, as well as the sample config: [Engine configuration](https://docs.sqlalchemy.org/en/14/core/engines.html#database-urls). Also, we'll be able to replace the `gpg-mailgate-web/schema.sql` file with a script that would initialise the schema. Using a dedicated tool to set up the database would be easier than having to issue database commands manually, esp. if we want wide adoption.
pfm self-assigned this 2022-04-23 12:16:40 +02:00
pfm changed reference from sqlalchemy to fix-cron-script 2022-04-24 10:09:55 +02:00
Author
Collaborator

It's been done within #64.

It's been done within #64.
pfm closed this issue 2022-04-24 10:24:49 +02:00
Sign in to join this conversation.
No description provided.