Hacker News new | ask | show | jobs
by wyw 6137 days ago
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.

Didn't know that. If that's correct, then the low-level db lib is an ORM in Python. In which case SQLObject/SQLAlchemy probably just harnesses those features and adds some additional cream on top.

1 comments

Most all low level rdb libs provide basic type conversion from allowed types in the db to type fitting the language you are using. From these libs you send SQL (any SQL you care to send) and you get returns of a "row" or a cursor usually.

An ORM adds stuff on top of the driver. General these frameworks provide relationship management, connection pooling, caching, and config management.

According to the Wikipedia definition of ORM, it's primarly about the mapping of types:

Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages.

http://en.wikipedia.org/wiki/Object-relational_mapping

Thats a pretty decent definition. I think their phrase "incompatible type systems" is meant for you to stress the word systems. The word type is not needed. Not to be confused with "type of an object, i.e. its class".

If you really want to know what's in various lower level drivers, as opposed to ORM frameworks (which vary quite a bit themselves), just go crack open some code and look at the APIs for yourself. You can go pretty far back to MS ODBC libs or even vendor dependent Oracle libs from mid to late 80s and see they were used quite effectively on their own for many years. JDBC was fairly straightforward derived from these predecessors.