Monday, May 31, 2010

Re: How can I test the correctness of my models against the schema of a database?

Thanks for the info Jani.

One question: How did you manage to make the tests in Django?
Because it forces you to create a test database and the idea of our
tests is to do them on an already full test database.
My idea if I can't skip it is to try and make them with the Python
Unit Testing Framework. But I would prefer all tests to be together in
Django.

Regards,
David

On May 31, 8:34 am, Jani Tiainen <rede...@gmail.com> wrote:
> Not really.
>
> If you're specially working with legacy databases trying to figure out that do
> Django models match underlying schema is PITA.
>
> We resolved this partially by doing few simple tests, namely running through
> all models and doing empty query. Since Django ORM queries for every field it
> revealed most of the problems right away. Of course we didn't checked lenghts
> or types of field.
>
> Also this could be useful in development phase when you add new fields.
>
> In django-command-extensions exists dbdiff command which produces somekind of
> diff against underlying database but it's in very early stages.
>
>
>
>
>
> > Sorry. I haven't use other methods for that.
> > But isn't it enough to test it using loremiser or something like that
> > and like an addition debug toolbar?
>
> > On May 31, 12:53 am, David Horat <david.ho...@gmail.com> wrote:
> > > Dear group,
>
> > > How can I test the correctness of my models against the schema of a
> > > database?
>
> > > To solve this question, I have tried unsuccessfully several options:
> > > - Using ./manage.py test triggers the creation and destruction of a
> > > database, but I want to check the correctness of the model against a
> > > production database, since I just want to check the schema, not the
> > > content.
> > > - Creating my own test runner as specified
> > > herehttp://stackoverflow.com/questions/138851which basically hacks the
> > > Django stack and gives you other problems. In any case this seems not to
> > > be the correct way.
>
> > > Has anyone of you faced this situation before? Any clues?
>
> > > Thank you in advance.
>
> > > Best Regards,
> > > David Horat
>
> --
>
> Jani Tiainen

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment