Tuesday, December 27, 2011

Re: preventing data from getting saved to the backend database?

On 28-12-11 00:01, Jim wrote:
> I'm a newbie reading documentation, and this question may well be
> answered by something I havent read yet, but anyway...
>
> My understanding so far is that django incorporates a back-end
> database (in my case built in sql3 on windows) to which all model
> related data from forms gets posted.
>
> I'm trying to write an app whereby the user can upload 2 sets of alarm
> files: a before and an after view, and then be able to filter and zoom
> in detail appropriately. However, each alarm file upload might
> comprise several hundred alarms.
> I'm only really interested in comparing these 2 sets of alarms, but it
> seems to me that by using django (and an alarm Class etc), that all
> these alarms will be pasted into the database every time a report is
> requested. That's not what I want, and at 2 x 200+ alarms per request,
> I can imagine me clogging up my alarms database at some point (but
> more importantly bloating with data I don't want to keep...).

Well, if you don't want to store the individual alarms in the database:
just don't.

Perhaps it is enough to have one "AlarmSet" class with two file (upload)
fields. The AlarmSet class can then have a before_alarms() and an
after_alarms() method that read the data from the two uploaded files.

There's no real need to convert the contents of uploaded files into
database objects, you can access the files themselves just fine. If that
is enough for you.

And if loading the info from those files all the time seems a bit
wasteful: use some low-level django caching and you'll be fine again.

Reinout

--
Reinout van Rees http://reinout.vanrees.org/
reinout@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
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