Tagged Questions
0
votes
1answer
110 views
ProgrammingError in inserting blob object in MySql using Python
I have a MySQL database and a table with the schema
tweet_id BIGINT
tweet_metadata LONGBLOB
I am trying to insert a row into my database as follows :
import MySQLdb as mysql
host = 'localhost'
...
0
votes
1answer
201 views
Python: Escape Single Quote from MySQL Query
I have a query string that runs in side a loop and for every item in the list query gets executed. The list contains strings and I use python string format technique to replace the query with the ...
1
vote
1answer
72 views
Unicode charactered filename SELECT SQL parameter issue
I have a webapp/webservice method created in django, which stores unicode character filenames on a DB-table. I am doing it by this method on the views.py script:
SubmissionContents(id=subid, ...
1
vote
2answers
191 views
Python 2.7.1, codecs, and MySQLdb; why is setting file encoding not needed
I have a small Python program that reads in SQL statements from a file and runs them on a MySQL database. The file is encoded in UTF-8 and the database also uses UTF-8.
If I don't set the database ...
1
vote
2answers
142 views
string decode method error in python
I have a function like this:
def convert_to_unicode(data):
row = {}
if data == None:
return data
try:
for key, val in data.items():
if isinstance(val, str):
...
2
votes
1answer
99 views
MySQLdb / Python: Can't insert certain characters in the db
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import MySQLdb
conn = MySQLdb.connect('localhost', 'django_user', 'haha123', 'mydb')
cur = conn.cursor()
f = ...
1
vote
1answer
153 views
arabic regex and MySQLdb in python
I've tried to get certain Arabic string from web page then store these strings into db.
The first problem
The only way I could is to specify how many letters are they by using . and use unicode, ...
2
votes
2answers
187 views
unicode in python turns into '\xXX\xXX'
I'm using MySQLdb, I use:
cursor.execute(QUERY)
Where QYERY is:
INSERT (A,B,C) VALUES("%s","%s",something);'%(k1, u'W')**
w Is a persian letter (literally it is! I just replaced it with W in ...
4
votes
2answers
191 views
How to insert and select greek words in mysqldb
I have create a DB and i use Mysqldb.
I want to insert and select data chars type, and that chars are in greek language.
I have set the collation of my database in utf-8_general_ci but, when i insert ...
0
votes
2answers
181 views
Greek characters insert mysqldb via TextCtrl ERROR
I have create in MySQdb a DB with a table named example,in this table i want to save a name,
this name is in Greek language.My problem is thw follown when i try to save the name instantly without use ...
2
votes
2answers
356 views
MySQL in Python: UnicodeEncodeError: 'ascii'
Hello I am trying to store a string value to MySQL, and i use db.escape_string() so not to escape special characters.
The string is
Lala*=#&%@<>_?!:;-'"/()¥¡¿
But when I try to run the ...
3
votes
1answer
1k views
Python, mysqldb and unicode
I'm having trouble to get unicode values out of mysql queries.
Here is how I do it now:
>>> from MySQLdb import connect
>>> from MySQLdb.cursors import DictCursor
>>> con ...
0
votes
0answers
291 views
Python mysqldb unicode problem
So the connection method I have
use_unicode = False
charset = "utf8"
I have use_unicode = False because... after what I think: I actually don't need a unicode string in the execute statement for ...
2
votes
1answer
1k views
Does the MySQLdb module in python returns utf8 encoding or unicode in this case?
Using MySQLdb I connect to a database where everything is stored in the utf8 encoding.
If I do
cursor.execute("SET NAMES utf8")
and fetch some data from the database by another statement. Does ...