A thread-compatible interface to the popular MySQL database server that provides the Python database API.
0
votes
1answer
13 views
MySQLdb Python execute not returning Table
I've been trying to use python's MySQLdb to execute SQL on a MySQL Database from SSH on my webhost. This program i wrote (on a mac) should print a table, but it doesn't.
Here's my code:
import ...
0
votes
1answer
14 views
Adding values with Python to Mysql using raw_input
What is wrong with this code?
I want to add values to my Mysql database using raw input but I can not do it.
The program runs perfectly but when I look into database in mysql none of the data was ...
2
votes
2answers
35 views
TypeError when inserting time into xlsxwriter
I'm importing two points of data from MySQLdb. The second point is a time which cursor.fetchall() returns as a timedelta. I had no luck trying to insert that info into xlsxwriter, always getting a ...
0
votes
3answers
25 views
Insert CSV data into django model using executemany
I have a csv file which have around 900000 rows with 13 columns, everything works fine till 28445 rows but after that it gives error
ProgrammingError
Exception Value: not enough arguments ...
1
vote
1answer
33 views
Install MySQLdb with Anaconda
I "successfully" installed MySQLdb using:
pip install mysql-python
But when I use the terminal to check, "import MySQLdb" throws this error:
Traceback (most recent call last):
File "", line ...
0
votes
1answer
15 views
How to install MySQLdb within my own setup.py?
I current have a setup.py file for an application I've written. Using setuptools I've easily been able to install pip-available requirements as such:
install_requires = [
'argparse',
...
0
votes
2answers
17 views
Python MySQL query to CSV in memory
I have a Python script which queries a DB and then emails the result. At the moment the script looks like this (please excuse my inexperience with Python)
db = mdb.connect(db_host, db_user, db_pass, ...
-1
votes
1answer
34 views
how to write query with joins
How I can make this query into single query? Can we use joins?
SELECT
id, parentID, name
FROM (
SELECT
GroupActivities.groupID AS "groupID",
max(GroupActivities.id) AS ...
-1
votes
1answer
4 views
Is it Okay to use SQLAlchemy in ETL for data about 100 million records or more in many tables
Will SqlAlchemy decrease performance ?
We are currently using raw sql in python and MySQldb.
3
votes
1answer
50 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
12 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
13 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
1answer
18 views
_mysql.pyd module is mishandling host name
Note: I've seen that the person in this question is apparently having the same problem, but since nothing useful has appeared there in over a year, and I have more clues, I'm asking in my own way ...
1
vote
0answers
18 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 ...
1
vote
4answers
38 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
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
19 views
db.cursor - result of query only returns first record
I have a situation where ss can be a list like [30, 31,32]. The result of this query only returns the first record not the rest of them. I am not sure what is wrong. I changed the code and just gave ...
-1
votes
1answer
38 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 ...
1
vote
2answers
29 views
Version error after pip installing MySQL-python on OSX
I have successfully installed MySQL-python to my virtual environment, confirmed by the fact that PyCharm can import it. I am however getting this message:
ImportError: this is MySQLdb version (1, 2, ...
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 ...
0
votes
2answers
28 views
Django Database Module
I am developing a system that will need to connect from a remote mysql database on the fly to do a specific task. To accomplish this, I am thinking to use Mysql-db module in python. Since the remote ...
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
1answer
25 views
How to use the Django ORM for creating an interface like MySQL admin that connects to multiple databases
So I'm fairly new to Django development and I started using the cx_Oracle and MySQLdb libraries to connect to Oracle and MySQL databases. The idea is to build an interface that will connect to ...
2
votes
1answer
20 views
Getting Results from MySQLdb as text
Currently each element in the the object obtained after a query is stored as the following:
((1L, Decimal('30'), Decimal('17')), (2L, Decimal('29'), Decimal('16')))
I want it in the format:
...
0
votes
1answer
9 views
Mysql Database Insert with Python via MySQLdb
This is super basic, but I cannot seem to get it to work correctly, most of the querying I've done in python has been with the django orm.
This time I'm just looking to do a simple insert of data ...
-1
votes
1answer
25 views
Python MySQL - MySQLdb - apostrophe in string breaks entry
Hi am inserting strings into a MySQL database which is working fine, up until one of my strings contains an apostrophe, as which point it breaks, and doesn't enter anything into the database. It is ...
1
vote
0answers
17 views
Is it possible to customize errorhandler in mysql-python? (using peewee)
I am writing a mibbleware around mysql-python. The aim is to wrap all mysql errors to my own handler instead of throwing an exceptiong and break the logic.
My middleware is using peewee like this
...
1
vote
0answers
70 views
'MySQL server has gone away' on Django 1.6.5
I am running Django 1.6.5 with mysql (5.6.17).
Have the following DB settings in Django:
DATABASES = {
'default': {
'ENGINE' : 'django.db.backends.mysql',
'NAME' : ...
-1
votes
1answer
23 views
Parsing ,error when insert into table
I'm getting error in my code while parsing and inserting to database 'a' is not defined.I am having a text file consisting of names and hobby.
qwer2.txt
My Name is Casssandra and my Hobby is ...
0
votes
1answer
16 views
Permission in Python to write to MySQL database?
I think I have a permission issue with python and mysql. Here is my test code test.py
#!/usr/bin/python
import MySQLdb
#change the host, user, passwd, and db below as necessary
db = ...
0
votes
0answers
15 views
Python Index Error
Ok. I'm stuck Any help would be appreciated. I'll start by saying I'm just trying to learn some Python, so hopefully this will be obvious.
I'm trying to pull a value out of a database, parse the "-" ...
0
votes
1answer
43 views
MySQL and Python is generating a duplicate entry error I cannot resolve
I'm new to MySQL but have a solid foundation in Python. After researching this extensively over the last 2 days including reading many stackoverflow questions and answers, I still haven't been able to ...
0
votes
1answer
24 views
Fully Qualified domain name in mysqldb syntex
Trying to connect to a hosted mysql instance in a python script and getting an error. From what I've read this seems to be down to be not using a localhost or ip address as the hostname.
Has anyone ...
0
votes
0answers
25 views
Compiling mysql-python on Windows with PIP
So I have Python 2.7 and setuptools installed on my Windows 7 laptop. I also have Visual Studio 2008 Express installed and MySQL with dev tools.
I am trying to install mysql-python via pip like:
pip ...
1
vote
1answer
32 views
Proper way to use PyMySql in a memory efficient generator
I want to write a generator function that will run on a memory limited system that uses PyMySql (or MySQLDb) to return the results of a select query one at a time. The following works:
#execute a ...
0
votes
4answers
40 views
MySQL Exact phrase match
I'm using python and the mysqldb module to search a database for a user input.
I have tested the python and established a connection to the server and database. It's the SQL code giving me trouble.
My ...
1
vote
0answers
22 views
how to implement a flask sqlalchemy query using a query that is passed into a function
I'm trying to convert this mysql query into flask sqlalchemy:
SELECT * FROM (*results query*) AS someDocuments WHERE agency in (SELECT agency FROM document WHERE agency ='Comptroller');
i'm ...
1
vote
2answers
34 views
mysql and Python: does not allow two timestamp columns
I'm having issues with Python, MySQL and creating a table with two timestamp columns.
Executing the following SQL through Python and using MySQLDB:
CREATE TABLE ...
0
votes
2answers
18 views
simultaneous connections to a mysql database
I made a program that receives user input and stores it on a MySQL database. I want to implement this program on several computers so users can upload information to the same database simoultaneously. ...
0
votes
1answer
14 views
Getting a mysql thread id from sqlalchemy Session
I'm used to creating connections using MySQLdb directly so I'm not sure this is at all possible using sqlalchemy, but is there a way to get the mysql connection thread id from a mysql Session a la ...
1
vote
1answer
22 views
MySQLdb: correct SQL request to group response data
I have two simple tables: authors and articles. You can find it here.
So when I execute MySQLdb query:
import MySQLdb
def test_code():
db = MySQLdb.connect(mysql_host, mysql_user, mysql_pass, ...
-1
votes
1answer
12 views
How to use MYSQL indexes in python 2.7 MySQLdb
indie = '''CREATE FULLTEXT yay ON panda (Question, Answer);'''
cursor.execute(indie)
I already have a connection to the server, database and table and it all works, but for some reason it won't ...
0
votes
2answers
41 views
Python mysql - cursor.close() db.close()
I am opening, accessing, writing, etc, to a database within various classes and threads in my application. I have one database self.run_params["db"] which I am using to access throughout my ...
0
votes
1answer
25 views
Executing python script from mysql procedure or function or workbench?
I have a python script which gives me a result by taking inputs.
And I have a mysql database. Now I want to execute the python script from mysql procedure or function!!
Is it possible to do it ?? If ...
0
votes
0answers
34 views
How can this be: mysql-python inside virtualenv IS installed, still “ImportError: No module named MySQLdb”
I've been hanging around here for a couple of years but have never really had reason to post something before, because there's already so many awesome threads here. However, now I've hit the first ...
0
votes
1answer
15 views
Error in MySQL query concerning IF statements in SELECT
I can't figure out what is wrong with the following query:
SELECT t_sh.source_file_id,
t_sh.id,
MAX(t_sh.master_event_id),
IF(t_sh.content REGEXP '[;}[:space:]]break;', ...
3
votes
1answer
35 views
What's wrong with my Python code to update MySQL table where ID = an integer?
>>> print x
[(1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (10,)]
>>> for i in range(10):
... if len(x)>0:
... m = random.choice(x)
... ...
1
vote
1answer
29 views
TypeError when inserting JSON data into MySQL using MySQL-Python
I'm trying to insert data from a JSON string to MySQL using MySQLdb. The total number of columns is fixed. Each row of data from the JSON string does not always have values for each column.
Here is ...
0
votes
1answer
61 views
MySQLdb Error: 'Unknown Database Python' using MySQL Workbench
When i run the code below in python 2.7.7, i get the error also below.
code:
import MySQLdb
db = MySQLdb.connect(
host="localhost",
port=3306,
user="root",
...
1
vote
2answers
37 views
python dynamic input, update table
I wrote a program in order to dynamically update a database table but I am getting an error. I stuffed the program with whatever I know little about. Here's my code:
import MySQLdb
class data:
...