Tagged Questions
-3
votes
0answers
18 views
How to group rows in mysql and then iterate through those rows in python?
I have a table in the form of:
user_id col1 col2 event_id
What I would like to do is to group rows based on event_id and then iterate over those rows.
For e.g if we have data like:
1 abc xyz 10
2 ...
7
votes
1answer
47 views
What python 3 library should I use for MySQL?
As far as I know MySQLdb still isn't ported to Python 3.
There seems to be another library called PyMySQL on pypy but the installation for python 3 looks strange (run a .sh script?). Also there is a ...
0
votes
1answer
22 views
Insert list with several items into mysql database
I have a list like this:
list = [('name1', 'id1', 'created_at1'),('name2', 'id2', 'created_at2'),('name3', 'id3', 'created_at3')]
And I want to put it into a Mysql Database using MySQLdb that it ...
1
vote
2answers
25 views
Python lists into MySQL Database
I have a question and I am actually already struggling with the approach how to tackle it.
I have several lists.
name = ['name1','name2', 'name3']
id = ['id1', 'id2', 'id3']
created_at = ...
1
vote
1answer
26 views
Asynchronous database inserts - python + mysql
I am making a utility in which I need to extract tweets for a user and store them in database. Twitter API only sends 20 tweets in one call and to retrieve more tweets, you need to page through the ...
1
vote
1answer
79 views
Inserting into MySQL table using peewee raises “unknown column” exception
I have the following script:
from peewee import *
db = MySQLDatabase('database', user='root')
class BaseModel(Model):
class Meta:
database = db
class Locations(BaseModel):
...
0
votes
3answers
282 views
python - why is peewee including the 'id' column into the mysql select query?
I am trying to learn how to use peewee with mysql.
I have an existing database on a mysql server with an existing table. The table is currently empty (I am just testing right now).
>>> db ...
0
votes
0answers
95 views
python 3 euro sign not encoded correctly
I am using a script to retrieve some data from a MySQL database with prices in different currencies.
Every currency symbol works fine, except for the euro sign (€), which returns the little square ...
2
votes
2answers
239 views
Connect Django to remote mysql server on a local network
I have setup Django and am a complete newb. I have successfully connected to a mysql database on my localhost but have had trouble connecting to a database that's hosted on another machine on my local ...
1
vote
1answer
2k views
UnicodeDecodeError: 'ascii' codec can't decode byte 0x96 in position 10: ordinal not in range(128)
How can I get data from a UTF-8-encoded MySQL database without getting the UnicodeDecodeError? I'm making a website using Python and HTML templates. Here's the code I used to get stuff from the ...
2
votes
3answers
1k views
Python Prepared Statements. Problems with SELECT IN
I'm having an issue with a prepared statement in Python I can't solve so far.
The Query, which should be execute is e.g.:
SELECT md5 FROM software WHERE software_id IN (1, 2, 4)
So I tried to ...
21
votes
1answer
5k views
Bulk insert with SQLAlchemy ORM
Is there any way to get SQLAlchemy to do a bulk insert rather than inserting each individual object. i.e.,
doing:
INSERT INTO `foo` (`bar`) VALUES (1), (2), (3)
rather than:
INSERT INTO `foo` ...
4
votes
4answers
1k views
Why does my python script randomly get killed?
Basically, i have a list of 30,000 URLs.
The script goes through the URLs and downloads them (with a 3 second delay in between).
And then it stores the HTML in a database.
And it loops and loops...
...
19
votes
4answers
20k views
Inserting a python datetime.datetime object into mysql
I have a date column in a mysql table. I want to insert a datetime.datetime() object into this column. What should i be using in the execute statement?
I have tried:
now = datetime.datetime(2009,5,5)
...
6
votes
7answers
549 views
Efficiently determining if a business is open or not based on store hours
Given a time (eg. currently 4:24pm on Tuesday), I'd like to be able to select all businesses that are currently open out of a set of businesses.
I have the open and close times for every business ...