0
votes
2answers
28 views

How do I store html data in a mysql database?

I have a sql written in python like . cur.execute("INSERT INTO products_details( title, description, price, currency, sku, brand, colors, sizes, actual_url, meta_title, meta_keywords, ...
0
votes
0answers
13 views

SqlAlchemy+Tornado: can't reconnect until invalid transaction is rolled back

i'm building a webapp with tornado+sqlalchemy and absolutely random i got this error File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception ...
0
votes
1answer
18 views

Append choices to choice list in Django models dynamically

I want to select the options from a list in my django models. But the options in the list are populated in the post_save() method.The situation is like this: I enter some attributes in the table1 ...
0
votes
0answers
9 views

Django syncdb return a KeyboardInterrupt when it is trying to install indexes

I'm trying to use scrapy to crawl some page and make the data crawed stored im MySQL database with django.so I create a django app,fill the models.py like following code(the code is too long so there ...
0
votes
0answers
14 views

Admin Deletes all give me mysql 1146 error

Here's the setup - Python 2.6, Django 1.4.12, Centos 6.5 When trying to delete an object from the Django Admin from the model "Entity", the error below occurs. The Project is called App is "portal" ...
0
votes
2answers
14 views

How to use NOT IN clause in sqlalchemy ORM query

how do i convert the following mysql query to sqlalchemy? SELECT * FROM `table_a` ta, `table_b` tb where 1 AND ta.id = tb.id AND ta.id not in (select id from `table_c`) so far i have this for ...
0
votes
1answer
13 views

Is slicing a queryset same as slicing the list used in __in clause? Can't understand this behavior

I have a Story model which includes a TagField through django-tagging app. I am fetching a list of stories for a particular tag. Functionally my code works fine, but I encountered a behavior which I ...
-1
votes
1answer
26 views

Python - install Pillow and MySQL-python on 1and1 hosting

I've created python virtual environment, installed django using pip and now I would like to install Pillow and MySQL-python using pip but it fails during compile process. (starting with python.h no ...
0
votes
0answers
33 views

How to insert big array to the mysql with python?

I have around 5000000 strings in array and I need to write each as a row to the mysql db, as fast as I can. Now I'm using multiprocessing: def my_api_off(api): print api db = ...
0
votes
0answers
15 views

python OperationalError: (1241, 'Operand should contain 1 column(s)')

I am trying to take data from an excel sheet and insert it into a MySQL table but get the following error which i do not fully understand. import xlrd import MySQLdb #get excel data file_location = ...
0
votes
2answers
28 views

Unable to set default values in Django models

I am trying to set default values for few fields like Date, Integer and CharFields, but when I am setting it like default=12 (in case of integer) it is not being reflected in page. However a default ...
0
votes
0answers
21 views

Mysql access denied error 1045 with Django app

I've been creating a webapp using Django and Mysql database, and it was working fine for a few months, but lately it's been acting up. I have a Linkedin auth system, which used to work on localhost, ...
-1
votes
1answer
24 views

pytho TypeError: 'str' object is not callable

I am trying to take the excel data which is the var 'y' which is numerical data and put it into my SQL column 'Close'. import xlrd import MySQLdb #get excel data file_location = ...
0
votes
0answers
16 views

Export and import data utf 8 encoded in csv format with a Python 2.7 script and MySQL

My goal : export some data from database1 and import it to database2 via a python script. My data in my two MySQL databases are encoded with utf8_unicode_ci. When I export the data in CSV format ...
0
votes
2answers
42 views

How to keep run Python Program in Background on Raspberry Pi after terminate ssh

i need to keep run my Python Program in Background on my Raspberry Pi after i close the ssh connection, Because i need to save Phidget information on a SQL DB I try to do this with nohup but it seems ...
1
vote
1answer
16 views

Python: LOAD DATA INFILE mySQL

I try to import data into a mySQL database using Python, but I can't get it to work. I don't get any errors it looks as if everything is working OK, but the text file never gets imported. I can ...
-4
votes
0answers
21 views

What's is the most suitable CMS framwork for my content management [on hold]

I have four tables in mysql, this is not very big. The main table consists of a few properties of a video information, such as url and shortcut. Now I want to do a CMS which can help content operator, ...
0
votes
0answers
15 views

Issue deleting a record from slave table in MySQL DB setup in replication from Django

I have a mysql Database that is setup in replication. The master has a_table (replicated) and Slave has a_table (replicated) and b_table (non replicated). b_table has an attribute that has a foreign ...
0
votes
2answers
33 views

create database by load a csv files using the header as columnnames (and add a column that has the filename as a name)

I have CSV files that I want to make database tables from in mysql. I've searched all over and can't find anything on how to use the header as the column names for the table. I suppose this must be ...
0
votes
1answer
22 views

How do I use mysql-connector-python with MAMP?

Command line mysql works as expected: mysql --host=localhost --user=django3 --password=django3 \ --database=django3 --port=8889 producing: ... Server version: 5.5.34 Source distribution ... ...
0
votes
1answer
22 views

Installing pymysql for Python 2.5.1 or lower

it doesn't seem like I can find PyMySQL for python 2.5.1 by searching google. Does anyone have external links. Where do I download/install PyMySQL for python 2.5.1 or lower? If it's not possible, ...
0
votes
0answers
22 views

retrieving data from rackspace database through python

I have very little knowledge of rackspace..My client has setup one server at rackspace cloud and saying that he created one database and I have to retrieve data from there , while logging into ...
0
votes
1answer
16 views

combine 2 tables and aggregate data

users Could you please help with following? I need to extract data from a mysql database and aggregate them. There are two tables in the database, both of them have data in a dfferent timestep. I ...
0
votes
1answer
24 views

Can't import MySQLdb into python

I have followed the steps in the website below, and installed everyhting for MySQLdb.I am using Xampp for the database and I have linked the mysql_config to the xampp mysqlconfig. ...
0
votes
0answers
44 views

Django model changes

I haven't been able to figure out the answer by google-fu, and I'm a little baffled. I'm trying to help a friend get some code up and running and ran into a bit of trouble while trying to change the ...
0
votes
0answers
30 views

How to view /template data from existing db using model in Django

I managed to connect existing mySQL with Django , but when I tried to view in my app. using : from task.models import stats data = stats.objects.all() for e in data: print e.name, 'starts on', ...
0
votes
0answers
17 views

Python altinstall creating conflict with mysql libraries

I installed Python2.7 on my mediatemple server to be available in paralle to the 2.6 version being used by CentOS. I used these instructions ...
0
votes
1answer
23 views

Python does not commit on insert query

I am trying to bulk insert locations on wordpress. I have defined functions to check and adding terms and taxonomy def checkTerm(term,con): cur = con.cursor() query = "SELECT term_id FROM ...
0
votes
0answers
14 views

Adding objects to multiple databases in Flask-SQLAlchemy Openshift

I am trying to add two separate objects to two databases using SQLAlchemy in a flask application hosted on Openshift. I have two databases joined by a bind using ...
1
vote
0answers
39 views

Adding headers to comma delimited string using Python 3.4

I have a static output from a serial connection which is comma delimited. The incoming data will always have 23 values. data string from machine: # "987654321 "," "," ...
1
vote
1answer
40 views

python program in django

I have been working on a problem and currently in a fix. The problem is that I need to transfer data currently in an excel sheet to MySQL database. So far I have been able to get the file on the ...
1
vote
2answers
78 views
+50

Using MySQL table as a queue with threads in Python

I have a DB with a queue table, new entries are inserted continuously in the queue. I want a Python script to execute the queue as fast as possible, and I think I need some threaded code to do so, ...
1
vote
1answer
33 views

python DELETE rows from mysql with REGEXP and mysql connector

Code setup according to examples found here: for ICAO_COUNTRY in ['GM','DA','DT']: table='aerodrome' query = 'delete from %s where code_icao regexp "%s[A-Z][A-Z]"' ...
0
votes
0answers
18 views

django-celery doesn't work with CONN_MAX_AGE

I am using Django 1.6.5, celery 3.1.13 and django-celery 3.1.10.Django has a new configuration "CONN_MAX_AGE" for database pooling since 1.6, but the problem is, when I config the database without ...
0
votes
0answers
28 views

django performance optimization

I have the following problem: My employers wanted some fields in the database to have encrypted values. So I used one of django apps (django-encrypted-fields) to have them encrypted. But then came ...
0
votes
0answers
17 views

update mysql using python

I am trying to update record in mysql database using python. matchob = re.search('(miR[0-9]+)', mir[1]) if matchob: fam = matchob.group(0) #This is a string cur.execute("""update eg set ...
0
votes
1answer
19 views

Python Email table from MYSQL

I am trying to get the results of a MYSQL query into the body of an email and also as a csv or xls attachment. My code below works and sends the email only problem is if the results from the MYSQL ...
0
votes
0answers
18 views

Using SQL in Python to compare fields and update columns accordingly

I have 2 tables: 1.source_table 2.target_table I want to check if x,y,z, fields from source table have any match to A,B,C fields in target_table, IF yes: Update values ...
0
votes
1answer
12 views

How to get mysql on an ec2 centos box with upgraded python

I'm trying to get to a MySql database through python, starting with a centos ec2 instance with python upgraded to 2.7 from 2.6. It's not working because my gcc compiler cannot find a the python header ...
0
votes
1answer
25 views

Passing variable number of args from Python to mysql

I want to build a query with variable number of arguments: group_ids = ', '.join(str(Rules[s].value) for s in groups) cursor.execute("SELECT a, b, c FROM my_table WHERE a IN (%(group_ids)s) ...
0
votes
1answer
37 views

Python NLP: How to store a python list to MySQL database?

I am learning natural language processing. I need to store a list e.g.["We","aren't","friends","."] to MySQL table's column, so that when i want to analyse it, i could read it from the database. Part ...
3
votes
1answer
728 views

Can not get mysql-connector-python to install in virtualenv

I'm using Amazon Linux AMI release 2013.09. I've install virtualenv and after activation then I run pip install mysql-connector-python, but when I run my app I get an error: ImportError: No module ...
2
votes
1answer
445 views

Not all parameters were used in the SQL statement (Python, MySQL)

I get an error on the following Python code: import mysql.connector cnx = mysql.connector.connect(user='root', password='', host='127.0.0.1', ...
7
votes
4answers
35k views

How can I change the default Mysql connection timeout when connecting through python?

I connected to a mysql database using python con = _mysql.connect('localhost', 'dell-pc', '', 'test') The program that I wrote takes a lot of time in full execution i.e. around 10 hours. Actually, I ...
2
votes
1answer
3k views

Python mySQL - escaping quotes

I have seen this question asked in various ways on this website, but none of them exactly addressed my issue. I have an sql statement with single quotes inside it, and am trying to use recommended ...
4
votes
5answers
3k views

Python JSON encoder to support datetime?

is there any elegant way to make Python JSON encoder support datetime? some 3rd party module or easy hack? I am using tornado's database wrapper to fetch some raws from db to generate a json. The ...
3
votes
1answer
3k views

Python / MySQL (MySQLdb) - testing the 'insert' function - its not adding rows. Why?

I'm trying to figure out how to use the MySQLdb library in python (I am novice at best for both of them). I'm following the code here: http://www.kitebird.com/articles/pydbapi.html Specifically: ...
16
votes
3answers
10k views

What actually is pymysql and how it differs from mysqldb? And how can it affect on my Django deployment?

Problem running manage.py sync db in django 1.3 was solved using pymysql instead of mysqldb. I also replaced it in django. I followed this tutorial: ...
20
votes
3answers
30k views

Escape string Python for MySQL

I use Python and MySQLdb to download web pages and store them into database. The problem I have is that I can't save complicated strings in the database because they are not properly escaped. Is ...
315
votes
8answers
251k views

How do I connect to a MySQL Database in Python?

How do I connect to a MySQL database using a python program?