James, Thanks for the response. The data is latter. I dont know the structure of incoming message. It can be a simple json or a nested json. I dont have a persistance store. I have a pipeline where a random json comes in and I would like to model the pipeline based on its structure. I need to read this json, present it to the user for further processing. I was wondering if there is something equivalent to jackson library in Java.
- Shekar On Thursday, 9 July 2015 13:41:37 UTC-7, James Schneider wrote: > > When you mention dynamic, do you mean that the data has a known set of > possible fields, but may only populate a subset of them? Or will it > just have random fields that you may not know about ahead of time? If > you have a way to articulate all of the possible fields that the data > source may use, then I would suggest creating a large model (or set of > models if needed) to encompass all of the possible data fields with > reasonable defaults. You'll also need to building the appropriate > de-serialization code to drop the various bits of data into those > models. > > You can probably write some code to grab the fields and create a > skeleton of a model definition (if the definition will remain static > once built), although it may be difficult to determine whether or not > a particular field should be a Char or an Integer field, etc. > > If you are using Postgres as your database backend, you also have the > option of storing the JSON directly into an HStore field. See > > https://docs.djangoproject.com/en/dev/ref/contrib/postgres/fields/#hstorefield > > for more information. > > Django doesn't support the idea of dynamic models since models are > tied directly to the database schema, and I doubt you want to modify > your database schema dynamically based on incoming data. > > -James > > On Thu, Jul 9, 2015 at 1:20 PM, Shekar Tippur <[email protected] > <javascript:>> wrote: > > Hello, > > > > I have a source of data that can have a dynamic json structure. > > Is there a way to dynamically create models based on this? > > > > - Shekar > > > > -- > > 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 [email protected] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > 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/49075845-52fe-4e9f-8e66-292491baea0a%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. 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/ff411298-6b32-48af-b54c-cfab2f47b5c8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

