Tagged Questions
1
vote
2answers
37 views
MySQL 'IF EXISTS' command causes an error when used in python
I'm trying to learn how to use SQL in python with MySQL (since all my projects use MySQL), but it seems to have issues with the IF EXISTS statement.
from command line:
DROP TABLE IF EXISTS ...
0
votes
2answers
29 views
Get the PK of GET Var Upon Submission of Django Form
I'm currently trying to insert into PathsOfDomain for pathToScan, FKtoTld fields. The problem is, I want to be able to grab the id field from Tld table for the submitted value (see view below) and ...
0
votes
1answer
10 views
MySQL-python installation - wrong architecture - MacOS
yesterday I've installed new version of python 2.7.5 via installer on MacOS
and unfortunately MySQL broke down. I got following error when starting
development server:
raise ...
0
votes
1answer
20 views
SQL: update A where B is max for each unique combo of C and D, where D is element of joined table
Since this is complicated I'll give an example of what I'm trying to attempt:
In the first table, User Data, I have user's and their saved game files (savefile's). Each user can be associated with ...
1
vote
0answers
32 views
OperationalError (2001, “Can't create UNIX socket (-1)”) - Django on Google App Engine
I'm guessing that this is a fairly simple problem, but I'm having difficulty putting my Django project on GAE. Pages that don't access my Cloud SQL database work fine, but whenever I try to access a ...
0
votes
0answers
22 views
Scrape & Parse PDF content to MySQL
I have a website that indexes and catalogs thousands of PDF documents. I am desperately trying to find a way to automate some of the database entry for these files. My question is the best approach to ...
0
votes
1answer
40 views
Run a script at a special time on django server
I have a django project and i need the ability for executing a function at a specified time on django server.
for example you can consider that in my django project if a client request for friendship ...
0
votes
1answer
22 views
pip-3.3 install MySQL-python
I am getting an error
pip version
pip-3.3 -V
pip 1.4.1 from /usr/local/lib/python3.3/site-packages/pip-1.4.1-py3.3.egg (python 3.3)
how to install MySQLdb in Python3.3 helpp..
root@lhackg:~# ...
0
votes
0answers
29 views
OperationalError when creating test DB after upgrading to Django 1.6
I've tried using both the new test runner in Django 1.6 and Django-Nose, same result. When I run syncdb and migrate, it works fine. But when I try to run my test suite, it errors out with:
...
0
votes
0answers
14 views
insert twitter json to mysql database using python
I have 14 json files each one of them is about 1GB contains the twitter raw json data that was streamed from the twitter streaming API. now I want to extract important data from these json files and ...
0
votes
1answer
48 views
DatabaseError python manage.py syncdb
I'm learning django framework and i have a problem with django When you start the syncdb
help me please, how to correct error?
used files
settings.py
DATABASES = {
'default': {
...
1
vote
1answer
21 views
pyodbc - Insert into MySQL not working
I am writing a script that reads data from one table, translates text in one of the columns into German using Google Translate API and load the data back into another table. Everything works except ...
1
vote
1answer
21 views
Python Mysqldb update operation with variables
I have a (maybe very simple) question, but I do not find the solution myself...
The database includes links. These include numbers.
Now I want to insert in a separate column "nummer" the number that ...
0
votes
0answers
19 views
How to query several similar databases using Peewee?
I'm stuck with a problem about querying multiple databases using Peewee:
I have 2 existing mysql databases (let's name them A and B) (Structures are similar because it's two Bugzilla databases)
I ...
0
votes
0answers
22 views
Display ordered data using django mysql
I have the following following django statement:
pending_companies = PendingCompany.objects.order_by('submit_time').reverse()
Output:
petroshkin Nov. 15, 2013, 2:27 p.m.
Copmew345 Nov. 13, ...
1
vote
1answer
41 views
Does a SELECT query have a return type in MySQL Python?
I am wanting to check if a specific row exists in a database using a SELECT query; if it doesnt exist I want to INSERT INTO the database with another query, if it does exist I dont want anything to ...
-3
votes
0answers
28 views
If condition in Mysql query not working in the where clause [on hold]
Here F_name, L_Name, Age, Gender are the column name in my table.
fname, lname, age, gender are the field data coming from the form.
The code which i have posted doesnot work. Is the If condition in ...
0
votes
2answers
42 views
Search multiple field form data in mysql database with python
How do i write a query if the multiple form field data are being searched in mysql database.
The form fields are as follow
FirstName:
LastName:
Age:
Gender:
Now we can enter data in any multiple ...
0
votes
2answers
34 views
MySQL if exists (select), update, else, insert with python using date comparison
i am trying to perform a db update on the condition that a db record exists in for multiple columns with values of type DATE in the event that their respective conditions are satisfied, but i appear ...
0
votes
0answers
55 views
Python MySQLdb execute table variable (Scrapy)
First things first. I am runing my Scrapy scripts(version: 0.16.2) on Python 2.7.2+. The problem that I have is with pipe files and SQL syntax that I generate using MySQLdb library.
Here is code that ...
-1
votes
0answers
22 views
Keep leading zeros when using Python xlrd to grab data from excel and populate table in mySQL
I'm a Python newbie and I'm trying to grab a cell of data from an excel spreadsheet, to populate a table in mySQL by using xlrd.
The data comes across to the table, but it has now dropped the leading ...
-1
votes
1answer
56 views
how do i write multiple conditions in single sql query to get data - Python mysql
I am in a dilema that how could i writ such sql queries to make a seach. I have tried and posted it, but it not as expected when user enter data in multiple field of a form and make a search.
The ...
0
votes
1answer
50 views
convert datetime string to datetime
I know questions like these get asked all the time, but my specific problem doesn't seem to come up (at least I can't find it).
So my problem is like this. I have a MySQL database which has lots of ...
0
votes
1answer
33 views
Returning 'encode' error when trying to output data to MySQL table with Scrapy
I'm very new to Python and Scrapy and trying to output the crawled data to my MySQL database, but I'm running into the following error;
exceptions.AttributeError: 'list' object has no attribute ...
0
votes
1answer
29 views
Python MySQLdb doesn't wait for the result
I am trying to run some querys that needs to create some temporary tables and then returns a result set, but i am unable to do that with MySQLdb api.
I already dig something about this issue like ...
0
votes
1answer
17 views
Getting an error when trying to use my add and remove functions in mysql-python
Whenever I try to use my addTask() and removeTask() functions I get a very long wait time followed by an error.
Here are the functions:
def addTask():
name = raw_input("Enter the name of the ...
0
votes
3answers
45 views
Start PYTHON script automatically [closed]
I have written a PYTHON script that controls my home's heating and AC system. It gets information and settings via a MYSQL database and communicates with the outside world via USB/Serial ...
0
votes
0answers
25 views
MySQL high cpu usage related to savepoint with Django
I have a Django powered site that infrequently (once every few weeks) gets stuck in a state of extremely slow performance. Pages that usually take 1-2 seconds to load may take 20-30 seconds. I found ...
1
vote
1answer
20 views
How do I use DATE_FORMAT inside my MySQL statement in Python?
I am trying to import rows of a csv file into a mysql table, I am using Python to do this.
Here's a snippet of my mysql statement from my python script:
sql = """INSERT INTO tbl_celebrants(id, name, ...
1
vote
2answers
24 views
Dynamic SQL join query in django
Here are three very simplified class I'm working with:
class User(AbstractBaseUser):
email = models.EmailField()
name = models.CharField()
is_admin = models.BooleanField()
...
0
votes
1answer
43 views
Parsing access log data to fit DB format
I have a web access CSV file with some statistics that looks like this (usually about 20K records but this is an example with only 6 records):
servlet name, HTTP RC, response time, request timestamp
...
0
votes
1answer
38 views
How to create a tree in NetworkX and display it in D3.js
I have to write a piece of code which takes some data from MySQL and use the data to make a graph in D3.js. My D3.js code is working when I give it static data in this format:
{
"name": ...
0
votes
1answer
19 views
data not inserted in flask sqlalchemy
This is my flask model(I am using Flask-Sqlalchemy).
class Feeds(db.Model):
id = db.Column(db.Integer, primary_key=True)
feed_link = db.Column(db.String(100))
url = ...
0
votes
1answer
27 views
MySQLdb/Python INSERT query not inserting data into table
I am attempting to insert values into a table via Python using the following code:
db = MySQLdb.connect(host="localhost",user="root",passwd="", db="x")
db.autocommit(True)
cur = db.cursor()
query = ...
0
votes
0answers
36 views
Use django with mysql on python 3.2 [duplicate]
I would like to use MySQL in my Django projects. All projects are made in python 3.2 on Debian, for developing I use SQLite without any problem.
In Django documentation MySQLdb (the official backend) ...
0
votes
0answers
26 views
Python to PHP API - Optimizing Performance
Let me start by saying that my current setup actually works, it is just not working to my standards. Right now, I have a Python script that monitors specific events and posts them to a PHP script I ...
1
vote
1answer
33 views
Why would a Date field be truncated when filling it in with a Date?
I have a MySQL table with a field of type Date in it.
I can update it as:
insert into mytable (date) values (%s);
I have some python code :
cursor.execute( update, mydatetime.date())
I get the ...
0
votes
0answers
47 views
Webfaction: python mysqldb Cannot allocate memory
I installed python mysqldb into a virtualenv on webfaction now I get the following error
tried to reinstall, remove and install it again but didn't help.
Can anyone help me?
Python version is 2.7.5
...
0
votes
1answer
39 views
Transferring data from MySQL to Neo4j
We're in the process of migrating our MySQL based Django application to Neo4j. In MySQL, we have a Providers table and a Referrals table. The referrals table simply has a provider_from_id, ...
0
votes
2answers
17 views
Python Code reading from port and storing in db gives error: #1062, Duplicate entry 1 for key PRIMARY
Using pyserial, I am getting data from a sensor plugged into the USB port. I am trying to store that data, using MYSQLdb, into a database.
cur = db.cursor()
cur.execute("TRUNCATE TABLE ...
0
votes
0answers
29 views
Django admin creating dozens of extra queries: why / how can I stop it?
I'm writing a post-save hook to automatically tweet content when it's posted to my site.
This relies on django-taggit: when a tag is added to a news item, and that tag has an associated Twitter ...
0
votes
0answers
32 views
Can't connect to MySQL server on %s? - MySQLdb
I'm trying to connect to my internet server using python.
To connect'm using MySQLdb library.
The problem is that I can not connect with Python, but if using other programs, such as MySQL Workbench, ...
0
votes
1answer
50 views
MySQL - web interface for data analysis & statistics
I am running a server with custom python software that collects and stores data from linux-based devices.
The data is stored on mysql and contains information such as serial numbers, access ...
0
votes
0answers
38 views
Django raw query with WHERE clause generated from previous query
I want to do a Django Python MySQL query with WHERE (in sql) being a link generated from a previous query.
Hereby I paste my actual code:
def population(request):
db = ...
1
vote
2answers
63 views
UnicodeEncodeError when MySQLdb show warnings
What I use: Python2.7 / MySQLdb 1.2.3
when I user MySQLdb.cursors to execute INSERT IGNORE INTO reporter('张三', '2013-11-11'), ('张三', '2013-11-11'),
it thow a UnicodeEncodeError Error like this, it ...
0
votes
1answer
37 views
Overriding the table name in Flask-Alchemy
I am creating a Flask application and accessing the MySQL database using Flask-Alchemy.
I have following Class to access a table:
class price_table(db.Model):
id = db.Column(db.Integer, ...
3
votes
1answer
72 views
How do I add 🍒 to my VARCHAR field via Python
I am trying to add a special character (🍒, codepoint U+1F352) to a VARCHAR field in a MySQL database and it's just giving me the empty string in the database.
sql = "UPDATE table SET special_char = ...
2
votes
3answers
58 views
In Django, how to find a term that is part of a string instead of containing that string?
For example, there are three rows under two fields in my table like this
id name
-------
1 brown cat
2 black dog
3 person
And here comes a string, or a sentence: A brown cat jumps over a person, ...
1
vote
1answer
23 views
Enable executing multiple statements while execution via sqlalchemy
I have a DDL object (create_function_foo) that contains a create function statement. In first line of it I put DROP FUNCTION IF EXISTS foo; but engine.execute(create_function_foo) returns:
...
3
votes
1answer
31 views
Finding the value of an auto-increment field
I have a simple registration form which creates a new record in "Students" table:
cur = con.cursor()
query = "INSERT INTO students (Name, Address, Major, Phone, Email, Password) values (%s, %s, %s, ...