On 1/20/07, limodou <[EMAIL PROTECTED]> wrote:
>
> > ./manage.py dumpdb > /foo/bar/out.data
>
> I don't like this. Because I want to save the data into different
> files according to each table, but not a single file.

#2333 doesn't do per-table, but it does do per-app:

./manage.py dumpdb firstapp > firstapp.data
./manage.py dumpbdb secondapp thirdapp > otherapps.data

Table-level doesn't strike me as a particularly good level for
serialization granularity, specifically because of cross application
dependencies.

> > If you create objects and foreign key relations in a single
> > transaction, there shouldn't be any issue with object creation order.
>
> Because the idea above, so it's not very suit for my requirement.

When you load data using #2333, what you provide is a label; Django
then searches each application for a data file matching that label. As
a result, you can have multiple data files with the same label, with
each application having a fixture directory to store the fixture data
files.

The transaction that is used is per-label, so all the 'initial_data'
fixtures for each app are loaded as a single transaction, eliminating
cross-app problems.

> I don't want to modify every line of data, but I need a default value
> dealing appoach. And #2333 doesn't support this idea. I didn't try
> #2333 for: if I remove some fields of a Model, and restore data from
> data file, how about #2333 will do?

I haven't tried - but either problem (default values for new fields,
and ignoring old fields) should be a relatively easy modification to
the existing serialization code.

> So your thought is very different from mine. I think core.management
> has many common methods, and users like me hope to reuse them. If
> there is no such plugin system, so I had to write my personal tool
> just like db_dump.py, and it'll be a whole program, and I need
> introduce many things I need from core.management which I think
> useful.

manage.py has useful methods? Then use them.

from django.core import management

print management.get_sql_all()

No need to add an extension API to manage.py.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to