Object Relational Mapping Pattern - using Sql Object

2,866 views

Published on

Relational databases and OO memory models use different paradigms. Mapping between one and the other is fiddly work so an auto-mapping tool like Sql Object (python framework) can help enormously.

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total views
2,866
On SlideShare
0
From Embeds
0
Number of Embeds
759
Actions
Shares
0
Downloads
31
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Object Relational Mapping Pattern - using Sql Object

  1. 1. SQLObject Object-Relational Mapper (ORM) for Python Presented by Andy Bulka [email_address] n et. a u
  2. 2. Impedance Mismatch <ul><li>Relational databases and OO memory models use different paradigms. </li></ul><ul><li>Management likes databases. </li></ul><ul><li>Programmers like OO models. </li></ul><ul><li>Mapping between one and the other is fiddly work. </li></ul>
  3. 3. The Basic ORM Solution <ul><li>A class is a table. </li></ul><ul><li>An attribute on a class is a column in a table. </li></ul><ul><li>Automatic mapping code in your classes so that setting attributes on objects has side effects (it changes the database). </li></ul>
  4. 4. SQLObject <ul><li>Provides a strong database abstraction, allowing cross-database compatibility e.g. SQLLite, MySQL, firebird, maxdb, postgres, sybase. </li></ul><ul><li>Possibly use sqlserver via mxODBC. </li></ul><ul><li>SQLRelay http:// sqlrelay . sourceforge .net/ . </li></ul>
  5. 5. SQLObject Joins <ul><li>One-to-one </li></ul><ul><li>One-to-many </li></ul><ul><li>Many-to-many </li></ul><ul><li>(Something which many ORMs do not have.) The join system is also intended to be extensible </li></ul>
  6. 6. Inheritance <ul><li>SQLObject supports inheritance </li></ul><ul><li>The inherited table does not have to repeat the attributes of the table it inherits from – just adds new attributes. </li></ul><ul><li>SQLObject will look after the mappings and for each OO memory instance, creates an entry in both tables. </li></ul>
  7. 7. An Example <ul><li>Object Model </li></ul>

×