Quantcast
Channel: MySQL Forums - Connector/Python
Viewing all articles
Browse latest Browse all 384

MySQL, Django, Python (2 replies)

$
0
0
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...

Viewing all articles
Browse latest Browse all 384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>