[Tutor] How to design object interactions with an SQLite db?

boB Stepp robertvstepp at gmail.com
Sat Aug 1 18:34:51 CEST 2015

I have never written programs to interact with a db.  I have never written an OO program.  So this is getting interesting rather quickly!

As I continue to ponder my project design, I see many of the classes I wish to create map naturally to db tables.  For instance the class Student can potentially have many data attributes, which fit naturally into its own db table.

My current thoughts are that I have two main ways of approaching this:

1)  Create my various objects normally, but have their data attributes fetched through some sort of db manager class I would design.

2)  Use an ORM (Object-Relational Manager) such as SQLAlchemy to manage interactions between my objects and the SQLite db.

Both routes will be quite educational for me.  Option (2), if I am understanding things correctly, would be more likely to make it relatively easy to change from SQLite to a more sophisticated server-based db in the future incarnations of this project.



More information about the Tutor mailing list