Reasons for using sqlalchemy in Qt

pyside, qt, sqlalchemy, sqlite

Solution

Basically, you have 3 options here.

QtSql

QtSql is a separate module in Qt for working with SQL databases.

Pros:

- Integration with Qt may be easier

Cons:

- Hard to learn

- Was made for C++, requires some redundant code

- Requires adding one more Qt module to your project

- Documentation looks bad

sqlite3 module

This a module in Python standard library to work with SQLite databases.

Pros:

- Very easy to use

- Code is quite concise

- No external dependencies

Cons:

- You do have to write SQL queries

SQLAlchemy ORM

SQLAlchemy makes work with databases similar to work with usual classes.

Pros:

- Object Relational Mapper: exposes an object-oriented interface and makes SQL queries for you

- Once you've set up the table information, work with databases is pure joy

Cons:

- Steep learning curve

Here's my conclusion: If you are comfortable with writing SQL queries and don't have to do a lot of work with databases, use sqlite3. And if you don't mind spending some time to learn something awesome, go for SQLAlchemy.

About the other projects you've mentioned: Elixir seems dead, and SQLAlchemy has its functionality built-in now, probably better. Camelot is just weird... I wouldn't use it.

Problem

This is really a "pardon my ignorance" question so apologies if it doesn't meet the requirements. I want to develop a fairly simple database application. It will be desktop based and lightweight so I'm happy that SQLite will suffice. I have also decided upon Qt and pyside. Looking through the mass of tutorials out there, I keep coming across sqlalchemy and exlixir (and Camelot). I am basically just wondering what advantages there are to using sqlalchemy (and elixir) over basic QSql in Qt? What would I be missing if I didn't use such a thing. I know this is basic but before I can progress on my self-tuition process, I just want to get this clear in my head.

Original source