Tagged Questions
0
votes
2answers
20 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
23 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 ...
0
votes
1answer
24 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
23 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
44 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
34 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 ...
1
vote
1answer
29 views
accessing a database from a python cgi
I configured the httpd file to run python scripts as given in a website. After the configuration I was amazed to see .py file getting executed when placed in the htdocs folder, but .cgi files are not ...
-1
votes
2answers
42 views
creating database in python
I have installed mysql for python and running python from command line. I am getting syntax error while creating a database.
>>> import MySQLdb
>>> CREATE DATABASE chom;
File ...
0
votes
1answer
28 views
Python: multiple installations
I was successfully using python in my programs and importing necessary modules including MySQL. However, to get IDLE on my computer I downloaded a new copy of python. I'm really not sure what I did or ...
0
votes
3answers
40 views
Inserting into MySQL from Python - Errors
I am trying to write a record into a MySQL DB where I have defined table jobs as:
CREATE TABLE jobs(
job_id INT NOT NULL AUTO_INCREMENT,
job_title VARCHAR(300) NOT NULL,
job_url VARCHAR(400) ...
0
votes
2answers
40 views
Python binding with Strings that include escape characters
My code is the following:
select_query = "SELECT DISTINCT name FROM people WHERE name in (%s)"
parameters = "'"+"','".join(['\\','--','where'])+"'"
cursor.execute(select_query, parameters)
print ...
0
votes
3answers
38 views
MySQL and Python: Convert string value to int, to float or what?
I have a string that contains salary information in the following way:
salaryMixed = "£25,000 - £30,000"
Sometimes it will look like this:
salaryMixed = "EUR25,000 - EUR30,000"
And others times ...
0
votes
0answers
21 views
MySQL Connector/Python - insert python variable to MySQL table
I'm trying to insert a python variable into a MySQL table within a python script but it is not working. Here is my code
add_results=("INSERT INTO account_cancel_predictions"
...
1
vote
1answer
33 views
Sort table by a column and set other column to sequential value to persist ordering
So I'm not sure whether to pose this as a Django or SQL question however I have the following model:
class Picture(models.Model):
weight = models.IntegerField(default=0)
taken_date = ...
0
votes
1answer
23 views
Merge similar records in MySQL (python & sqlalchemy)
I've an huge database table, composed by Music genres.
There're almost 35000 records, most of them are mainly expressing the same genre, for example:
+-----------+
| Name |
+-----------+
| ...