Monday, April 29, 2013

Re: Store arbitrary key-value pairs in model?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJRfovMAAoJEFjlhRo+xFTE7L8QAIewkOmBaUeK2VUkPfhDpvah
beNMH/v8dceMQomPtpC/iNkGqmQ87lKd/TsAqcQcJFIVG1Ju1Mk4YMHYVMjm5d9A
uqjNYcrZKmVZGElVdCQBVTZZE6PpeK4nM80ExFhMRCwlCj8YyLBL2M8luNzVqiwJ
RZ/cGWnMNZQmhqHWCuAsSp++A/e+OIRkNBy+eJdN5CogWqR4ncTkx4aEZS4P6Lty
/oYiM/as5DAYpzQh9mfpbi/Vyj2WquGYpHCEBCzxMdJ1CjBoKzkx7qTxVVrGq7HW
EFjPMT7qGzRdAyNarbQoLgl9oY0UqaMnyy722UxDMxDrpFtNab7MSgcNfnT8+ZOt
D622BhPqoXZm4zfAV/BKhqmDaVeYQsMAgp8UA/FiXQEGLNSePYJ1Ve8lL1QfEdUR
HpDZjw5HQ/oAlZTqCK4y9fmlkdFckEL8Q8Sopf64ASGksnCwAG5a+ak+HTldFuLm
G/Viwd2LT6YXqbOmAMw0GBROi0GuGcixsDpf2UokLK1SObj0t8Q7RPcCgy4OsVjG
eoQGi33oGJUTqSMMnVYHx+TPyzuOA3d8mrXm7+lr/2J6O1RP4qCFrSCxbR4NFydC
L7AGhZR5XaRkxNFJCE/N4E/T+6+ebmYDhGNrcVbAiRp/eTXsVibqOTkTRHPFuCXN
m8xlU6oCjwxrNNHhbhVC
=Ljl2
-----END PGP SIGNATURE-----
On Mon, 29 Apr 2013 05:58:44 -0700 (PDT)
Victor Hooi <victorhooi@gmail.com> wrote:

> Hi,
>
> I have a Django application that will need to store arbitraty
>
> Basically, there are a series of "job scripts" that are submitted by
> users and then run.
>
> Each of these jobs scripts may have an arbitrary number of key-value
> pairs attached to them (for example, output directory, or search
> term, or email address etc.).
>
> There variables are then used by each script. The set of variables
> varies for each job script.
>
> Is there an easy way to model this within Django?
>
> We could store a serialised dict as a blob, but that sounds rather
> hackish.
>
> I was thinking a document database (e.g. MongoDB, or Couch DB) might
> be more suitable, however, I'd like to keep it within Django, if
> possible (Django and relational DBs are widely used where I am, and
> there's good support for them).
>
> Cheers,
> Victor
>

Well, how about something like having model with fields (job_id, param,
value)? You may need to squeeze-in an ordinal in there as well -
(job_id, position, param, value).

Best regards

--
Branko Majic
Jabber: branko@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: branko@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.

No comments:

Post a Comment