|
|
|
|
|
by wyw
6137 days ago
|
|
You mentioned a "common approach". Is this the approach that you use or have you found a better way? The reason I ask is I don't quite understand how your description above correlates to an ORM type-mapping system. Customer.find() returns a customer which contains your dict. I don't know python but I assume a dict is a type-less hashmap. So if your customer has a field called 'updated_at', wouldn't you need to write a function to convert that type appropriately for the application since the application doesn't know whether it's a Date, Datetime or Timestamp? |
|
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.