MySQL Forums
Forum List  »  Connector/Python

MySQL, Django, Python
Posted by: Michelle Becker
Date: August 03, 2010 07:30PM

Hi!

So I have a sort of complex question, I'll try to make it as clear as possible but please ask me to clarify if needed.

The project that I'm working on requires me to take the data from a legacy database in MySQL, and, using Django apps written in Python,
create a website that would graphically show the data (weather vs time) on a chart taken from the Google Visualization API template- written in html.

The issue that I am having is that once the data is pulled out of MySQL with Django, it is automatically stored into one of three formats depending on how I call to it, so far I have tried the following:

SomeVariable = MySQLDataTable.objects.all() ## which stores the data in the form of a django query set which is kind of like a list of stuff under the class of my django app model

SomeVariable = MySQLDataTable.objects.all().values() ## which stored the data in the form of a list of dictionaries really... using a for loop i was also able to convert this into a new, single dictionary of two keys (temp and time) each with many values. From there, I then assigned a separate variable to each keys' values, sorting the values into a list. so, it looked like

AllTemp=NewDictionary["TemperatureF"]
AllDateTime=NewDictionary["DateAndTime"]
AllID=NewDictionary["id"]

Thus, I was hoping to simply call the varibles in the google viz html line... but that did not work so well....

Lastly,

SomeVariable = MySQLDataTable.objects.all().values_list() ## stores the data as a list of tuples containing the temp and time info. I wasn't really sure how to go about implementing any process while the data was in this format, but if you know/think of something I would for sure appreciate it.


Anyhoo, net net I guess my question is how do I get the html code to pull the data from the MySQL lists and return a nice, and pretty graph??? I'm trying to stay away from saving the MySQL data tables in the form of a csv...



Edited 1 time(s). Last edit at 09/16/2010 09:17PM by Guelphdad Lake.

Options: ReplyQuote


Subject
Written By
Posted
MySQL, Django, Python
August 03, 2010 07:30PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.