Filipe wrote: > I'm starting a new project and am looking for the right framework for > it. Django is the best candidate so far :) > > If I understand right it's not mandatory to have a relational database > to use Django, as long as one does not inherit models from > "meta.Model". > > My question is, how about using an already existing database? I will > need to use a database of an application that is currently in > production (I can't touch it's schema), so the DB won't be generated > from my model in Django. Is it possible to use model classes without > the object-relational mapper (as if no relational database was used) > and still use SQL to directly manipulate data in a DB? > > If someone could also direct me to some examples would be great.
I'm doing exactly this. I have already patched inspectdb to some extent to give better results ... see ticket #1561. You might really want to use this patch to generate your first model if it's more than a dozend of tables. Django has obviously been built not with having existing databases as a first priority. Though, it does work, and for me it's still the best solution around. There is one major problem (as I see it), that is tables with a composited primary key. Django does not support it. There's a work around, but this probably will require you to use plain sql to access this table. I think other ORM mappers such as SQLAlchemy are better for existing databases, especially for the old and and really ugly ones, but it's also non-trivial to use these with Django, you'd lose most of the cool stuff (admin pages, generic views, form and validation framework). You can also use the Django model classes and still use direct SQL, if you need to. Now, if you're going to use anything else, I'd really like to know what you did! Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---

