by Virax · 17y ago · 0 comments
* we use Python+MySQL
* each table has an associated class, a CRUD-API if you will
* a cursor object accesses a table like this:
cursor.TableName.select_by_ids(low, high)
* removing means set time_removed to the current timestamp
* rows are returned as lists of dicts
So the solution to the object-relational mapping problem is: for each table, there is a class that manages access to it, and a row is represented by a a dict.Did you consider using SQLObject or SQLAlchemy? If so, I'd be curious to know why you decided against using them?
Most client drivers/libs for RDBs have basic type conversions for each language. You don't always need an ORM for this. If you have a ruby or python Time object, the low level db lib generally will convert it to/from the RDB format.
I've used both simple and complex mapping methods. At the moment, I'm using mongodb with very simple first class object wrappers around the hash/dict. This is appropriate for this new app.
For an app I already have in production, I use postgresql and ruby's datamapper. This limits me to knowing that adding some features requires more work so those features keep getting pushed off the plate. The reason I use postgres for this app is because my users expect RDB ACID properties. For the new app I'm working on, not so much.