Tagged Questions
1
vote
0answers
18 views
Extremely slow raw SQL queries on web2py
db.executesql() takes 30 seconds to return a result, despite the fact that same query takes 0.5-1 second if I try it on the MySQL console or with the same code on the web2py debug console or on the ...
0
votes
0answers
11 views
Python check for mysql changes in database and update
I have created a little dbf to mysql converter, which i want it to be able to check for changes. I have made my script that reads the dbf file and uploads it to the mysql database. How would i then ...
0
votes
2answers
41 views
How can I switch my Django project's database engine from Sqlite to MySQL?
I need help switching my database engine from sqlite to mysql. manage.py datadump is returning the same error that pops up when I try to do anything else with manage.py : ImproperlyConfigured: Error ...
0
votes
1answer
12 views
python dbf to mysql
I'm trying to make an dbf to mysql connector in python. So far i have got it to connect the mysql server and read the dbf file but when I run the program it shows that none of the data has replicated ...
0
votes
1answer
29 views
Python read and write 2 DBs
I have never really used python before.
Before getting into it, I had a quick question to check the feasibility of something I am planning to do here.
I have two servers, MySQL server and postgresql ...
-1
votes
0answers
20 views
How do i escape single quotes added by parameterization %s in python [duplicate]
I have been parameterizing my queries like a good pythoner, but now want to parameterize my table and wonder how to get rid of the '' that parameterization creates on the query:
query = "SELECT * on ...
0
votes
1answer
16 views
How to reduce the number of times a heavy objects.all query runs on foriegn key field in Django?
I found that the MySQL DB was becoming unresponsive each time I would load the admin page for a model. I investigated and found that the query Model.objects.all() was running innumerable times, I ...
0
votes
1answer
6 views
Wrong query result in sqlalchemy ZopeTransactionExtension
I have application on bottle.py. This application work with MySQL through sqlalchemy. Start version I am simple define session and do commit.
engine = create_engine(SQLALCHEMY_DATABASE_URI)
Session = ...
0
votes
2answers
30 views
Django - Exclude two conditions in query
What's the best way to do this?
Object.objects.filter(country_send=country).exclude(status__exact='').order_by('-id')
...
0
votes
1answer
26 views
Can I use MySQL on Django1.6.x with Python3.4 in Windows8? [on hold]
I have set Django 1.6.6, MySQL 5.6.17, Python 3.4 in Windows 8
I have been tryed below link
Can I use MySQL on Django(dev 1.6.x) with Python3.x?
But I could not.
For 2 weeks... I have could not ...
2
votes
1answer
15 views
celery task and django queryset cache
I am trying to get celery to work but I have some issues, which I don't quite understand.
I am inheriting a model from a 3rd party package
class BaseModel(models.Model):
class Meta:
...
0
votes
1answer
18 views
mysql service start time
Is there any variables in mysql that will return the date on which mysql service was started?
I am using following 4 steps to get the mysql start date.
mysql> select now(), unix_timestamp(now());
...
1
vote
1answer
22 views
MAMP Python-MySQLdb issue: Path to libssl.1.0.0.dylib changing once Python file called
I'm trying to use python MySQLdb to access my MySQL database on my MAMP server.
When I initially tried to call a Python file with python-sql to access my database on MAMP I got the image not found ...
0
votes
0answers
45 views
'NoneType' object has no attribute 'endswith', django , python
My project structure is something like:
/blog1 (Name of project)
/blog1/media/blog1/media
/blog (Name of app)
/blog/media
/static
/media
/static/templates
I have uploaded a photo through ...
0
votes
1answer
23 views
SQLAlchemy select with where constraint
I am trying to get a subset of a table from my database. The database is a MySql database.
Python code:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ...
0
votes
3answers
34 views
Python/MySQL - LOAD DATA LOCAL INFILE
I am using the mysql connector for Python and I'm trying to run the following SQL statement via Python (Windows):
sql1 = ('SET GLOBAL local_infile = "ON";')
cursor.execute(sql1)
sql2 = ('LOAD DATA ...
1
vote
2answers
34 views
How to convert array string to an array in python [duplicate]
Im trying to convert an array that ive stored in a mysql database (as a string) to a standard array in python an example of what I mean is:
This is what i get from the database:
...
0
votes
1answer
41 views
Join mysql tables one after the other using python
I am new to both python and mysql. I want to join 21 mysql tables one after the other using python.
I know there is UNION ALL function in mysql which can do it. But, How to do it in python.
My code ...
1
vote
3answers
18 views
Closing python MySQL script
I was wondering if one of you could advice me how to tackle a problem I am having. I developed a python script that updates data to a database (MySQL) every iteration (endless while loop). What I want ...
-1
votes
0answers
35 views
MySql Query is very slow
I'm selecting desired data from different tables and I have added different condition in select query also. It is too slow I want to know alternate query which run faster than this. Perhaps joins ...
1
vote
0answers
23 views
Python MySQLdb not refreshing database information
I'm currently codiing a simple IRC moderator/utility bot. I plan to have a web interface that will easily update command data and whether or not the command is enable using a MySQL database to store ...
0
votes
1answer
21 views
Creating Double precision columns using SqlAlchemy from Alembic
I need to use a DOUBLE column in my MYSQL db. I've read the docs, which suggest I use a Float with precision of 64. This, however, doesn't seem to be working. I end up with a regular float column, ...
3
votes
1answer
34 views
Python: MySQLdb library encoding issue
I have a mysql db. I set charset to utf8;
...
PRIMARY KEY (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
...
I connect to db in python with MySQLdb;
conn = MySQLdb.connect(host = ...
0
votes
1answer
10 views
sqlalchemy treatment of attributes on read (staleness)
This might be a silly question, but I can't find the answer anywhere.
Let's say I pull some values:
widgets = session.query(Widget).all()
for widget in widgets:
# ... do lots of things here
...
0
votes
0answers
27 views
MySQL Connector/Python InterfaceError: “Failed parsing EOF packet”
As far as I can tell, I have installed the MySQL Connector/Python (v1.2.3) module without a problem. This is on CentOS 5.4 using Python 2.7.7 (Anaconda distribution, although the same happens on a ...
-7
votes
0answers
41 views
running shell scripts from python [closed]
In my usual bash scripts, I do something like this:
echo "select * from table" | sudo mysql
How would I do this using Python without using import MySQLdb?
0
votes
2answers
22 views
Python: Iterating through MySQL columns
I'm wondering if you can help me. I'm trying to change the value in each column if the text matches a corresponding keyword. This is the loop:
for i in range(0, 20, 1):
cur.execute("UPDATE table ...
0
votes
1answer
28 views
openssl Library not found
I've looked through dozens of posts about this and nothing seems to work so I think I'm just missing something but I'm doing a beginners tutorial on making a website using python so I'm not totally ...
1
vote
2answers
43 views
Catching OperationalError 1040 in Django
I run my Django website on a shared server and so from time to time my users get an Internal Server Error 500 page due to the specific OperationalError Exception identifying itself as (1040, "Too Many ...
1
vote
2answers
39 views
mysql_info() equivalent in Python
I'm looking for a mysql_info() equivalent in Python.
My script executes a LOAD DATA LOCAL INFILE statement and I would like to have information like this : Records: 3 Duplicates: 0 Warnings: 0.
I ...
1
vote
1answer
31 views
SQLAlchemy, scoped_session - raw SQL INSERT doesn't write to DB
I have a Pyramid / SQLAlchemy, MySQL python app.
When I execute a raw SQL INSERT query, nothing gets written to the DB.
When using ORM, however, I can write to the DB. I read the docs, I read up ...
2
votes
2answers
49 views
How To Fetch data in Python from mysql database
I am new to python and i am facing problem while fetching data from mysql db while i am passing parameters in mysql query i think my mysql syntax is incorrect .
Here is the Error displayed on Screen ...
0
votes
2answers
33 views
How to design models.py when I want to store the complex data like this?
I'm learning to use Django and try to design a system which aims to recommand musics.However,I am thrown into confusion when I think over how to design models.py.
Every song has its tags,such as ...
1
vote
0answers
23 views
Django MySql, how to get timestamp functionality
Before introducing Django I had a table for time series data that used the MySQL type "timestamp" for the timestamp field. I could easily insert my time series data into the table, with timestamps as ...
-1
votes
1answer
35 views
Most efficient way to save POP (Gmail) emails to MySQL database [closed]
I need to run queries on emails I receive from Gmail. I have POP and IMAP access to it as I am running Google Business Apps. To avoid API usage, I am interested in simply downloading emails to a MySQL ...
0
votes
1answer
21 views
MYSQL vs ALTERNATE way to simply record IPs of visitors ? FASTEST METHOD?
Suppose your web site only needs MYSQL just to record
visitors IP addresses. this can be used to count views
and so on.
Would there be something faster than..
having to connect to MYSQL and then run ...
0
votes
1answer
72 views
Mac OS X - EnvironmentError: mysql_config not found
First off, yeah, I've already seen this:
pip install mysql-python fails with EnvironmentError: mysql_config not found
The problem
I am trying to use Django on a Google App Engine project. However, ...
-1
votes
0answers
14 views
Adding a child node to a JSON node dynamically
I have to create a nested multi level json depending on the resultset that I get from MYSQL. I created a json object initially. Now I want to add child nodes to the already child nodes in the object.
...
1
vote
1answer
33 views
Google App Engine “Error parsing ./app.yaml: Unknown url handler type”
I'm following a tutorial on how to install PHPMyAdmin on Google App Engine and I followed the directions exactly and when I go to push the app, I'm getting a parsing error. This is the tutorial link:
...
0
votes
0answers
11 views
Python MySQLdb insert query not working [duplicate]
I am writing a python script that is supposed to insert a list of names from an array (where they are stored as strings) into a table. When I run the dbInsert() method it runs perfectly, however ...
0
votes
0answers
16 views
Django: options-dict with --skip-secure-auth
I am trying to set up a read-only connection to a production MySQL DB, which I'm not allowed to upgrade. It's one of three DB's I try to connect to in my Django-project: two DBs run MySQL 5.5, and one ...
0
votes
1answer
20 views
Using sqlalchemy to query using multiple column where in clause
I'm looking to execute this query using sqlalchemy.
SELECT name,
age,
favorite_color,
favorite_food
FROM kindergarten_classroom
WHERE (favorite_color,
favorite_food) IN ...
0
votes
0answers
13 views
SQL Django merge tables and update the foreign keys
I have 2 database A and B, both have table auth_user (id, username).
I have to merge them in the table auth_user in database B, check the new users and update the existing.
The problem now when I ...
0
votes
1answer
24 views
Python Mysql variable with %
def getstuff(letter):
curSelect.execute("SELECT id,name,age FROM `people` where name like %s ",(letter) )
getstuff('A')
My problem is that i am trying to get a list of everyone in the database ...
1
vote
1answer
25 views
MYSQL error with Python
for row in cursor.fetchall():
currentid = str(row[0])
links = soup.findAll('a', {'class':'lightboxImage'})
for link in links:
file_name = ...
1
vote
0answers
25 views
Lost connection to MySQL server when using multiple connections
I'm trying to run a multithreaded script.
1 thread works fine. However, when I go to 2 threads, it will execute a few SQL commands, then it will stop with:
OperationalError: (2013, 'Lost connection ...
0
votes
1answer
41 views
How can I pass arguments to QThread Worker class? [duplicate]
I have a working example of code that creates a QThread that must be called from my on class (MyClass). I have tried passing additional arguments through the Worker init, but I can't get it to work. ...
0
votes
1answer
24 views
Solr & User data
Let's assume I am developing a service that provides a user with articles. Users can favourite articles and I am using Solr to store these articles for search purposes.
However, when the user adds an ...
1
vote
1answer
21 views
How to view the contents of a database in AWS RDS?
I have a small mysql RDS database associated with an Elastic Beanstalk python application. I'd like to view the contents of the database and download its contents onto my local machine. How can I do ...
0
votes
0answers
21 views
Python - SQLAlchemy - MySQL - multiple instances work on same data
I have a table in a database, mapped with SQLAlchemy ORM module (I have a "scoped_session" Variable)
I want multiple instances of my program (not just threads, also from several several servers)to be ...