Tagged Questions
0
votes
2answers
17 views
How to get instance of database and close it? Tornado
I'm having trouble with MySQL timing out and going away after 8 hours. I am using google app engine as a host. My Python script uses the Tornado framework.
Right now I instantiate my MySQL db ...
0
votes
2answers
27 views
Cloning Django models or add a differentiating field in the second model?
I have to store live streaming 'test' data and training data in a mysql database. I need to make Django models for the same. Now the structure of the data is exactly the same i.e. time, value, label. ...
0
votes
0answers
18 views
Getting 'Deadlock found when trying to get lock; try restarting transaction'
I have multiprocessed application, and each thread executes the following python code:
while True:
db_cursor.execute("SET autocommit=0;")
db_cursor.execute("LOCK TABLES prqueue WRITE;")
...
0
votes
1answer
7 views
Should I use MySQL Lock Table or there exists better solution?
I'm working on a multiprocessed application, and each process sometimes executes the following code:
db_cursor.execute("SELECT MAX(id) FROM prqueue;")
for record in db_cursor.fetchall():
if ...
-5
votes
0answers
22 views
Suggestion on Architecture for a web app [on hold]
I plan to develop a web app where a person can say anything in a comment. After which would the comment would be stored into a database. If anyone tries to search for specific keywords they can search ...
0
votes
0answers
64 views
django_tables2 reloading previous page when I press “next” or sort by column
I have a very simple Django app that asks the user to input an author and then queries a database and outputs a table. There is a search page and a table page. I am using django_tables2 to display ...
0
votes
0answers
26 views
How to make correct url map?
I have Python app on webapp2 in GAE + mysql.
This app fetch 2 remote feeds every 2 hours
http://example.com/feed1
http://example.com/feed2
and push data from it to database.
ID DATA
1 data ...
0
votes
1answer
13 views
Calling Python script in PHP post PHP 5.4
Basically I want to call a simple python script from PHP. I have a PHP page that is adding requests from an html page to a Mysql table, and I'd like this PHP page to call a python script which email ...
-1
votes
2answers
30 views
How to store Chinese in MySQL?
I already set
character-set-server = utf8
In my.cnf.
I restarted the server and recreated the database, but when I tried to insert Chinese into database, I received this error:
ERROR 1366 ...
3
votes
1answer
40 views
Push notification from MYSQL
I am having my database created in MYSQL and a WebSocket application(Autobahn Wamp WebSocket v1) created in Python.
I have an application which makes entries in my database.
My requirement is that I ...
1
vote
0answers
11 views
Query via Python's MySQLdb library works fine locally but not on Elastic Beanstalk
As the title indicates, I have a simple query that works fine locally but is causing an internal service error when executed on EB.
The code is super simple:
#Connect to the database
db = ...
0
votes
0answers
18 views
Python mysql connector access denied error
I've read everything possible and I just can't connect to my mysql server. Here is my code. very simple. (I used xxx to hide all the private info. everything else is the way i got it.
import ...
0
votes
0answers
10 views
SQLAlchemy blocking in custom MySQL functions
I'm using SQLAlchemy in combination with some custom created MySQL functions.
Given a stored MySQL function
FUNCTION `get_foo_id`(`p_filename` CHAR(64), `p_filetype` CHAR(2))
My Python/SQLAlchmy ...
0
votes
1answer
28 views
How to transfer int variable from python to javascript? [on hold]
I am currently doing a project wherein latitudes and longitudes are stored in a MySQL database. I plan to use these coordinates to create an overlay on top of google maps. to do that I require the ...
0
votes
2answers
55 views
Very simple user input in django
My underlying struggle is I am having trouble understanding how django templates, views, and urls are tied together... What is the simplest, bare minimum way to prompt the user to input a string, then ...
0
votes
2answers
17 views
How to get the MySQL type of error with pymysql?
I'm doing a Python application with MySQL and pymysql and I'd like to be able to know the number of the MySQL error when I get one so that I can do something different depending on it.
Is there a way ...
0
votes
2answers
19 views
Python MySQLdb error when trying to alter a table
I am trying to alter a database but I am not sure of the exact syntax and I am having trouble finding it online. The line that is giving the error is:
cur.execute("ALTER TABLE Units ADD FOREIGN ...
0
votes
0answers
12 views
cursor.execute(…) for string prefix search
Suppose I have want to do a string prefix search in database, say
select * from some_table where name like 'abcde%';
where abcde is actually some user input string. How do I do it in MySQLdb in ...
0
votes
0answers
9 views
MySQL Alchemy, Creating a new empty class for every table
Is there a more elegant solution than passing unique classes to each table you want to use in MySQL alchemy mapper class.
Here is how I'm doing it based on the documentation:
from sqlalchemy import ...
4
votes
1answer
73 views
Isolation level with Flask-SQLAlchemy
I'm having trouble understanding how database isolation levels work with Flask-SQLAlchemy, and especially how to really commit changes or close a session. Here is the context of my problem :
I'm ...
1
vote
1answer
36 views
Why I can not use an installed module for python?
I have installed a python library MySQLdb, and it works yesterday. But today when I tried to run it, it goes on as following:
czhao@opx790:~$ python
Python 2.7.7 |Anaconda 2.0.1 (64-bit)| (default, ...
1
vote
0answers
13 views
String substitution using cursor.execute of mysql.connector
I am using mysql.connector to execute some simple SQL statements. In this example I am creating a database schema. I want to pass the database as a variable and use substitution in the SQL.
I believe ...
0
votes
0answers
49 views
pip install MySQL-python, error: command 'x86_64-linux-gnu-gcc' failed with exit status 1, #define HAVE_WCSCOLL
Hello I am have issues installing MySQL-python with pip. I have installed MySQL with the MySQL APT Repository format.
I have tried using the normal fixes given by google/statckoverflow:
sudo ...
0
votes
1answer
25 views
django accessing to models takes so much time
I have a model like this:
class Event(models.Model):
description = models.CharField(max_length=3072)
severity = models.CharField(max_length=96)
reception_timestamp = models.DateField()
...
1
vote
2answers
27 views
mysql insert duplicate values into table
I am trying to insert values into a mysql table using python,I have some values but i donot consider whether duplicate keys/non duplicate but i want every values to be inserted.
For my mysql coding ...
1
vote
4answers
35 views
How to protect mysqldb connection in python?
I'm creating a pygtk app that needs a mysql connection from a remote db.
db = MySQLdb.connect("remotehost","username","password","databse", charset='utf8')
App is almost completed and going to be ...
0
votes
0answers
15 views
How do I configure sqlalchemy to correctly store emoji?
With sqlalchemy 0.9.7, I am trying to store emoji into MySQL 5.5 with utf8mb4 enabled. However, for some reason sqlalchemy is killing my emoji chars and I cannot figure out why. I can see the emoji ...
0
votes
1answer
24 views
How to access MySQL Python Connector with Python 2.7.8 and Sublime Text 3 on OS X 10.9
I'm trying to set up MySQL to work with python 2.7.8 and Sublime Text 3 on OS X 10.9, so I installed the MySQL python connector. Whenever I try to run "import mysql.connector", I get back ...
0
votes
1answer
18 views
How to change DEFAULT CURRENT_TIMESTAMP format
Currently i am using the following code to create a table in mysql.
CREATE TABLE example(id INT, ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
so whenever i insert data into this table i get the value of ...
0
votes
1answer
13 views
how to apply LIMIT/OFFSET on large table in sqlalchemy while getting intermediate result as well [please read the details below]?
I want to do 3 operations on a table which contains large number of records: (1)filter (based on a search query) (2)order_by (on a single column in asc/desc) and (3)slice (for given offset and limit ...
-1
votes
0answers
23 views
Celery Multiple Workers with Mysql [on hold]
I need to build a scheduler to handle distributed crawling. I have to crawl about 50,000 urls each day. Currently , it's handled using cron scripts(unix).
I heard of celery and working on it to know ...
0
votes
0answers
12 views
Django CMS 3 - Duplicate entry for a plugin
I have a problem with Django CMS.
The main Problem is that
Django CMS saving data twice to database.
I need a dependence between two Plugins. I add a plugin and choose the appropriate plugin (via ...
1
vote
0answers
26 views
Django Failed to install index for?
When trying to migrate my django site to a fedora server and trying to run python manage.py syncdb/ test results in the following errors. How should I proceed to determine what is causing these ...
-1
votes
1answer
27 views
MySQLdb import error Enthought Canopy
I'm about to lose my mind over this one, so any help is much appreciated.
I'm working with win8.1, and Enthought Canopy Python 2.7.6 that I'm running from the command line. I initally had ...
0
votes
1answer
5 views
Error while running inpspectdb in Django with MySQL Connector and Python 3
I'm going to post a question and then post the resolution to the problem, I've found the solution after being stuck for some time so I thought it might be valuable for other people using the command ...
0
votes
0answers
28 views
Python: MySQL DELETE issues
I am trying to delete a value from a table with 2 columns; twitch and name.
This is the code:
cur2 = db.cursor()
cur2.execute("SELECT twitch FROM Alan45wmzYGCc5C7TIMCdczrel.whitelist WHERE twitch ...
0
votes
2answers
15 views
Error with scrapy item object
I am having a problem with the Scrappy item object. The current problem is that when I scrape certain fields I save them like such:
item['tag'] = response.xpath("//div[contains(@class, ...
0
votes
1answer
7 views
Verify thread-safety MySQLdb (Python) prior to Trac installation
I'm trying to install Trac manually for the first time. I don't want to use a one-click-installer like Bitmani, I want to learn how to install Trac manually, so I'm following the instructions ...
-2
votes
0answers
24 views
Getting data from backend nodes to frontend web servers?
Imagine the following simplified network diagram:
[Internet]
|
[www1] (PHP/Apache)
|
[app1] (Python)
|
[db1] (MySQL)
Each tier (www, app, and db) has it's own applications and ...
0
votes
2answers
135 views
Loop through Mysql Results
This is the code I have:
r = ''
while True:
data = result.fetch_row()
r+= record[0][0] + record[0][1] + record[0][0]
print r
What I want to do is, first fetch all the rows:
data = ...
-5
votes
0answers
30 views
Designing database in MySQL for heavy read and write operations [closed]
There will be a web application which will allow user to register. Once registered, user fill out some 40-60 questions which will include multiple choice, drop down etc (of different types), finally ...
0
votes
0answers
11 views
Randomly Getting “Got an error reading communication packets”
I have been getting this error a dozen a day or so. I've googled for advice and don't see anything helpful.
140725 1:45:29 [Warning] Aborted connection 406119665 to db: 'XXX' user: 'trans_user' ...
0
votes
1answer
18 views
Load csv into mysql using Python syntax error [duplicate]
I have a TSV file with the following structure:
#DAteTime Userid tweet (each separated by \t)
2009-06-07 02:07:41 http://twitter.com/hokiepokie728 @fabro84 'Before the Storm' is a new song ...
1
vote
3answers
59 views
Using %s commands in execute statements (python) in mySQL vs postgreSQL?
I've been writing code recently in python that works with postgreSQL databases, and it looks like the following:
def insert(table, ID, date, timestamp):
cur.execute("""INSERT INTO %s (ID, date, ...
1
vote
2answers
30 views
Python: Best way to keep track of particular values within dictionary
I'm using SQLAlchemy to query a db. The resulting output is a list of dictionaries.
Sample output
[{'status': 'complete', 'value': '1', 'question': 'q1', 'user_name': u'Charlie', 'id': 4054810},
...
0
votes
1answer
30 views
Errors in SQL Syntax
I am trying to run MySQL query through a python script and keep getting an error in my SQL syntax, from I can see the query is set up correctly. Could someone please give me a second set of eyes on ...
0
votes
0answers
26 views
SQL error 1064 quote in Python
it's possible many people had solved my problem, but, I don't know why ?
I work on python to insert soma data in my database,
Python Code and query :
db = ...
0
votes
0answers
34 views
How to insert record with a many-to-many relationship?
I have a class Consignments in this class I have a relationship to a Sims class:
class Consignments(Base):
__tablename__ = "consignments"
id = Column(
Integer,
...
1
vote
0answers
21 views
Using cursors with mysqldb and flask
It's more of a theoratical question but i have been trying to find a correct answer of it for hours and yet i have't arrived at a solution. I have a big flask app and it contains multiple routes.
...
-1
votes
0answers
29 views
Write Microsoft Word Doc with MySQL data
I'm programming a MySQL database with Web interface for remote access. I used Django as a framework. But now, I want to generate some reports using the MySQL data and modify them after generating. ...