MetricsGrimoire / MailingListStats

Mailing List Stats is a command line based tool used to analyze mboxes
http://metricsgrimoire.github.com/MailingListStats/
GNU General Public License v2.0
38 stars 25 forks source link

Support SQLite as DB #56

Closed wwahammy closed 9 years ago

wwahammy commented 9 years ago

While MySql is certainly a more full featured DB, SQLite has the advantage that it can run without a service or setup. Adding support for SQLite as a database backend would reduce the initial setup burden on new users.

gpoo commented 9 years ago

sqlite is supported since we started to use SQLAlchemy. IIRC, I used sqlite for some unit tests. At least, there is support in pymlstats/db/session.py. For example, to test only session:

$ python pymlstats/db/session.py sqlite:///foo.db
$ sqlite3 foo.db .tables
compressed_files      mailing_lists_people  messages_people     
mailing_lists         messages              people
$ sqlite3 foo.db ".schema mailing_lists"
CREATE TABLE mailing_lists (
    mailing_list_url VARCHAR(255) NOT NULL, 
    mailing_list_name VARCHAR(255), 
    project_name VARCHAR(255), 
    last_analysis DATETIME, 
    PRIMARY KEY (mailing_list_url)
);

It is possible there is missing some documentation and/or integration, but the infrastructure is there.

gpoo commented 9 years ago

As I suspected, I had implemented sqlilte support when porting mlstats to SQLAlchemy.

$ mlstats --db-driver=sqlite --db-name=bar.db [...]

If bar.db does not exists, mlstats will create it. It is undocumented, but it works. Although, there is a regression if the db is empty and nothing to parse (see #58).