Or “When not to use something that looks like it’s obviously going to make your life so much easier” 🙂
SQLAlchemy, Declarative layers, and the ORM ‘Problem’
On first glance, its pretty obvious that everyone should love Elixir vs the obviously more tedious SA approach of layout out your tables, then mapping them to the class objects. However, look at these two examples, and try to quickly answer the following questions:
- How do you add a column to the many to many table to store an additional bit of info for the join?
- Do they both enforce referential integrity?
- How do you control whether SA is eager loading the relation? Can you restrict it to just one column of the relation?
- What are the table names used?
- How many tables are in your database?
- Where do you change the id column name?
- Which one is closer to the Zen of Python?
Advertisements
Leave a Reply