Saving Contionus Data through Django

29 views
Skip to first unread message

nitinag...@gmail.com

unread,
Apr 2, 2015, 2:10:23 PM4/2/15
to django...@googlegroups.com
Hello All

I am new to Django. And, I need help in models file.
I made a table - device_list. It contain one filed as device_id.
Now, I need to store 3 continuous data stream which is coming like 1 entry per minute each for this device_id.
All 3 data streams will have different timestamps and that also needs to be stored.

So, what is the best way to store the stream ?




Ilya Kazakevich

unread,
Apr 2, 2015, 2:34:17 PM4/2/15
to django...@googlegroups.com
You can't just store stream in database.
You need to buffer it first, and then save to field like blob: http://www.postgresql.org/docs/9.1/static/datatype-binary.html

I am not sure that relational database is the best place to store binary data coming from devices.

aRkadeFR

unread,
Apr 2, 2015, 2:48:29 PM4/2/15
to django...@googlegroups.com
Not sure Django is the best solution to your problem.

As Ilya said, you should buffer it. Then you can work
with your buffered data. You said one entry every minute,
so the "buffer" can just send this entry every minute to
a Django project?
--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/69d2b2a4-5928-488f-a923-f03750d1eea6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Dewhirst

unread,
Apr 3, 2015, 4:31:47 AM4/3/15
to django...@googlegroups.com
Ok - so each device has three datastreams. You need to decide whether
the data in each stream should be stored in a single table or perhaps in
two or three tables. Without knowing what you want to store it isn't
possible to advise you.

Anyway, each datastream model needs to have a foreign-key into the
device_list model. To record the time you include a field of class
models.DateTimeField with an auto_now_add=True option which puts the
current date/time into that field.
https://docs.djangoproject.com/en/1.8/ref/models/fields/#datetimefield

By the way, it would be more conventional to name that model (ie.,
table) device rather than device_list.

If you are new to Django, the best advice usually given is to work
through the tutorial. That will show you how to establish foreign key
relationships between models.

I think Django is fantastic and I hope you enjoy.

Mike

>
>
>
>
> --
> 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...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/820ad2ed-7163-4fdd-adf0-5e50a12308fb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/820ad2ed-7163-4fdd-adf0-5e50a12308fb%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages