Re: Store arbitrary key-value pairs in model?

2013-04-29 Thread Branko Majic
On Mon, 29 Apr 2013 05:58:44 -0700 (PDT)
Victor Hooi  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: bra...@majic.rs
Please use only Free formats when sending attachments to me.

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


signature.asc
Description: PGP signature


Re: Store arbitrary key-value pairs in model?

2013-04-29 Thread Shawn Milochik
A Django app sometimes benefits from a "No-SQL" database on the side. You
could do what you want using a text field and storing JSON or a pickled
value, but I advise against it. It's hard to query and de-duplicate.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Store arbitrary key-value pairs in model?

2013-04-29 Thread Victor Hooi
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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.