Tagged Questions
0
votes
2answers
21 views
Migration: Creating UserProfile in Django/MySQL
I have created a UserProfile field in order to add a favorites functionality to my site. Using Django's recommendation, I created a UserProfile model as follows at the bottom
Unfortunately, I already ...
0
votes
0answers
65 views
Why does my script get this error?
I have a Python script running every four hours. This is the crontab line:
* */4 * * * pi python /var/www/scripts/testProg.py >> /var/log/testProg.log
In the /var/log/testProg.log file I can ...
0
votes
2answers
15 views
Python operators pymysql
I'm having some bad time with pymysql and python operators.
I don't know much about python operator though.
I want to insert into the database some values. The code:
import pymysql
conn = ...
1
vote
1answer
15 views
UPDATE statement error - MySQLdb/Python
I'm testing an UPDATE statement on an existing record in my test table. It looks like this:
term = 'example-column'
termInserted = term + '_inserted'
mostRecentRecord = 6
nResult = 777
...
0
votes
1answer
13 views
INSERT statement error - MySQLdb/Python
I have the following code:
cur.execute("INSERT INTO term_results(%s, %s) VALUES (%s, %s) WHERE results_id = %s", (term, termInserted, nResult, bResult, mostRecentRecord))
term and termInserted are ...
0
votes
1answer
22 views
when redirecting getting an error malformed header
the other day i saw in stack overflow how to get redirected using a function..
but its not working here
#!/Python27/python
import cgi
import cgitb ; cgitb.enable()
import MySQLdb
from datetime import ...
0
votes
1answer
11 views
Simultanous AJAX requests and MySQL database data visibility in Django
I have a Django app with a MySQL database which allows answering of questions on an HTML page. The answers get sent to the server via AJAX calls. These calls are initiated by various JavaScript events ...
1
vote
1answer
40 views
how to search a string using argumnet
I was trying to pass the query to mysql database
here is the code
#!/usr/bin/python
import sys
sql = "select count(distinct offering),count(learner),count(distinct learner),sum(transaction ) from ...
-2
votes
2answers
46 views
What the mysql command does? [closed]
I was using Mysql from python and I was modifying a code but I can't understand what the following statement means:
Table-submission: The columns are sid (student id) problemid (problem id) language ...
0
votes
2answers
31 views
MySQL, Python - Latin-1/UTF8 Encoding
I have read around setting MySQL tables/DB to UTF8_general_ci charset from the default latin-1 where I was having an error inserting particular unicode strings into the MySQL table from my Python ...
0
votes
1answer
25 views
how to save an instance of a Django model to my database
I have a model called Job that I want to save to my database. My template has passed its fields to my View function as POST data. I am wondering how to from here take that, create some kind of Job ...
1
vote
1answer
29 views
Using MySQLdb to return values - Python
I have a table called coords and it is defined as:
mysql> describe coords;
+-----------+--------------+------+-----+------------------+----------------+
| Field | Type | Null | Key | ...
0
votes
0answers
26 views
Memory leak with large dataset when using mysql python
I am experiencing what I believe is a memory leak when using the MySQLdb API
Line # Mem usage Increment Line Contents
6 @profile
7 10.102 MB 0.000 MB ...
1
vote
1answer
45 views
Why would django give me an ObjectDoesNotExist error on a newly created object?
I just ran into this while testing some code that uses django to handle orders. I'm getting an "ObjectDoesNotExist" error when trying to load (by id) a newly created record.
Here's a skeleton of how ...
0
votes
1answer
35 views
Python mysql string substitution not working
I've been using this syntax with great success in python mysql.
search = "O'%" # find names like O'Brien or O'Connell...
cursor.execute ("""
select userid
from usertab
where name like ...