Hey Filipe,

Filipe wrote:
> Custom SQL + Manipulators does sound as the way to use my own model
> classes. It doesn't seem as the most straightforward way to use Django
> though, anyone out there actually working with Django this way?
> 
> Michael, are you actually using Django (ORM included) with a "legacy"
> database, or are you evaluating what the best option might be?
> I was trying to stay away from ORMs, not only because I think I'll find
> some problems with it (given I have to use this particular schema) but
> also because a great deal of the website I'll build is about searching
> for data in the database and I don't think I'll take a lot of benefit
> from an ORM there.

Yes, I am going this way, but I'm still on the way :-)

Actually, using the ORM is pretty nice. It's so much easier to write
Blabla.objects.filter(customer__name__exact=xxx, is_active=True) than to
write SQL with correct quoting etc. again and again.

I have only a few tables that have composite keys, and all of these are
association tables. I use custom sql to load the related models, and I
don't even load the model objects for the association tables at all.
Thus, I don't really need to specify the association tables in the
model. That works fine. For everything else, I happily use the ORM.

I'd advise you to evaluate whether loading/saving model objects with
custom sql works as expected. If you have only few problem tables,
mixing ORM with custom SQL should still be better than using custom SQL
only, but that's probably a matter of taste.

Hope that helps,

Michael


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to