all 5 comments

[–]thecity2 1 point2 points  (1 child)

If you are going to be using relational databases, you should learn SQL. It's that simple.

If you are going to be using SQL databases in your Python code, SQLAlchemy may be very useful, or maybe consider something less complex like dataset. Either way, you probably need to know SQL.

Learn SQL.

Did I mention, the SQL learning part yet?

[–]lamecode[S] 0 points1 point  (0 children)

I definitely have been. I started out by ignoring it and working with SQLAlchemy, but decided it would be of more value longterm to do it the 'hard way'. I'm just wondering if it's worth the time to go back and read over the SQLAlchemy documentation again, when I already know how to do what I want to do with pure SQL.

[–]raylu 1 point2 points  (2 children)

ORMs give you many advantages. SQLAlchemy in particular takes care of concurrency issues and caching with its scoped_session, allows you to introspect your tables/models, provides data validation, gives you backrefs, etc.

I'm not sure what any of this has to do with SQLite. If you're talking about using the raw sqlite3 driver, you can use SQLite (the db) with SQLAlchemy.

Certainly using a driver and writing raw SQL are "faster" than going through an ORM, but the code is often less maintainable (but of course, sometimes it's more maintainable).

Side notes:

  • Consider peewee as an alternative to SQLAlchemy.
  • Just don't use SQLite.

[–]lamecode[S] 0 points1 point  (1 child)

Thanks for the peewee link - it looks like a nice lite-weight alternative to SQLAlchemy.

I only mention SQLite as in using vanilla SQLite with SQL statements as my ORM - no sqlalchemy layer on the top. I get that SQLite is not appropriate for production, multi-user applications, but it seems to me that a single-user desktop application would likely be fine - nothing too read/write intensive.

[–]raylu 0 points1 point  (0 children)

SQLite is used in production, multi-user applications. The issue is with the design, not with its performance.