Tagged Questions
-1
votes
0answers
12 views
python for loop -mysql
Data
uid Chr_postion chr_start chr_end region gene
1 chr1 934380 934586 HES4_69.395 HES4
2 chr1 935336 935537 HES4_72.3360 HES4
3 chr1 984384 984583 AGRN_99.4969 AGRN
...
0
votes
0answers
13 views
How to copy a database with mysqldump and mysql in Python?
I am writing a simple Python script to copy a MySQL database. I am attempting to copy the database based on the following SO questions and their answers: "MySQL copy/duplicate database", "python ...
-1
votes
1answer
41 views
Difference in SQL [on hold]
I am planning on learning SQL.
I am looking at SQLAlchemy, since I am rather familiar with Python.
I am wanting to know, is SQL the same even if the sql is in MySQL or MSSQL or any other. Or is it ...
0
votes
0answers
15 views
django run server error with mysql
After I solve the issue with "image not found" when I run python manage.py syncdb by adding "export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/" into .bash_profile.
The problem comes with python ...
0
votes
1answer
18 views
Django query using mysql date functions
I was wondering can you perform the following query in Django using models and queryset?
SELECT count(*), DATE_FORMAT(FROM_UNIXTIME(created_at/1000), '%Y-%m-%d') FROM users
GROUP BY ...
0
votes
1answer
13 views
Why does this http thread pool die (join), but keep functioning?
The following code takes an initial string ('a', 'b', or 'c'), and the two thread types pass it back and forth, appending 'W' and 'H' to it repeatedly, marking that the Worker thread or the Http ...
0
votes
0answers
6 views
Is a PyMySQL connection causing my heap to overflow?
I have a class for connecting to a mysql db, and one thread repeatedly makes calls to the db (select, insert, update) (it makes many calls). My heap is overflowing, I presume because of a memory leak, ...
0
votes
1answer
24 views
How to transfer SQL Group by results to a Pandas dataframe
I have sql query that return a data set in following format
user_id, type_id, avg
1, 3, 2.5
1, 2, 3.0
1, 5, 4.6
1, 11, 3.4
2, 2, 4.5
2, 3, 3.0
2, 11, 3.1
data above comes from following query, and ...
0
votes
1answer
31 views
Running MySQL query from Python 2.4 while not installing modules (MySQLdb)
I need to run a MySQL query from Python 2.4 but I cannot download/install any modules for Python.
The reason I cannot download is because this script is to be run on servers (RedHat) and our ...
1
vote
1answer
37 views
How to estimate the value of a column for each month from a table having date data in mysql?
I have a mysql table 'data_table' in mysql with around 5 million records like:
------------------------------------------------------------------
serial | month from | month to | ...
0
votes
0answers
21 views
How to Load International Data into MySQL Using CSVKit?
I am loading a a pipe-delimited file of hotels into MySQL using CSVKit (https://csvkit.readthedocs.org/en/0.9.0/index.html).
Some of the hotel name fields contain "non-English" characters ( e.g. ...
0
votes
0answers
39 views
In Django cursor.execute(“select ..”) randomly returns None
I am running Django + MySql on OpenShift server and have this problem.
Code:
from django.db import connection
...
cursor = connection.cursor()
somedate = calculateSomeDate()
qurey = "SELECT id ...
-1
votes
0answers
35 views
How can we use Python, Javascript and MySQL on a website
My goal is to use the following:
MySQL (database)
Python (Connection to database and outputs information that will be taken from Javascript)
Javascript (Frontend to display information)
I tried ...
0
votes
1answer
38 views
Syntax error using INSERT INTO statement with MySQL-Python
I'm trying to populate a table in a MySQL database with the values for each row coming from a text file, using this SQL syntax:
INSERT INTO Table SET
Fieldname1 = "value1",
Fieldname2 = "value2",
...
0
votes
2answers
38 views
How do I store html data in a mysql database?
I have a sql written in python like .
cur.execute("INSERT INTO products_details(
title,
description,
price,
currency,
sku,
brand,
colors,
sizes,
actual_url,
meta_title,
meta_keywords,
...
0
votes
0answers
23 views
SqlAlchemy+Tornado: can't reconnect until invalid transaction is rolled back
i'm building a webapp with tornado+sqlalchemy and absolutely random i got this error
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
...
0
votes
1answer
19 views
Append choices to choice list in Django models dynamically
I want to select the options from a list in my django models. But the options in the list are populated in the post_save() method.The situation is like this:
I enter some attributes in the table1 ...
0
votes
0answers
10 views
Django syncdb return a KeyboardInterrupt when it is trying to install indexes
I'm trying to use scrapy to crawl some page and make the data crawed stored im MySQL database with django.so I create a django app,fill the models.py like following code(the code is too long so there ...
0
votes
0answers
16 views
Admin Deletes all give me mysql 1146 error
Here's the setup - Python 2.6, Django 1.4.12, Centos 6.5
When trying to delete an object from the Django Admin from the model "Entity", the error below occurs.
The Project is called App is "portal" ...
0
votes
2answers
16 views
How to use NOT IN clause in sqlalchemy ORM query
how do i convert the following mysql query to sqlalchemy?
SELECT * FROM `table_a` ta, `table_b` tb where 1
AND ta.id = tb.id
AND ta.id not in (select id from `table_c`)
so far i have this for ...
0
votes
1answer
14 views
Is slicing a queryset same as slicing the list used in __in clause? Can't understand this behavior
I have a Story model which includes a TagField through django-tagging app.
I am fetching a list of stories for a particular tag. Functionally my code works fine, but I encountered a behavior which I ...
-1
votes
1answer
28 views
Python - install Pillow and MySQL-python on 1and1 hosting
I've created python virtual environment, installed django using pip and now I would like to install Pillow and MySQL-python using pip but it fails during compile process.
(starting with python.h no ...
0
votes
0answers
34 views
How to insert big array to the mysql with python?
I have around 5000000 strings in array and I need to write each as a row to the mysql db, as fast as I can.
Now I'm using multiprocessing:
def my_api_off(api):
print api
db = ...
0
votes
0answers
15 views
python OperationalError: (1241, 'Operand should contain 1 column(s)')
I am trying to take data from an excel sheet and insert it into a MySQL table but get the following error which i do not fully understand.
import xlrd
import MySQLdb
#get excel data
file_location = ...
0
votes
2answers
30 views
Unable to set default values in Django models
I am trying to set default values for few fields like Date, Integer and CharFields, but when I am setting it like default=12 (in case of integer) it is not being reflected in page. However a default ...
0
votes
0answers
21 views
Mysql access denied error 1045 with Django app
I've been creating a webapp using Django and Mysql database, and it was working fine for a few months, but lately it's been acting up. I have a Linkedin auth system, which used to work on localhost, ...
-1
votes
1answer
25 views
pytho TypeError: 'str' object is not callable
I am trying to take the excel data which is the var 'y' which is numerical data and put it into my SQL column 'Close'.
import xlrd
import MySQLdb
#get excel data
file_location = ...
0
votes
0answers
23 views
Export and import data utf 8 encoded in csv format with a Python 2.7 script and MySQL
My goal : export some data from database1 and import it to database2 via a python script.
My data in my two MySQL databases are encoded with utf8_unicode_ci.
When I export the data in CSV format ...
0
votes
2answers
55 views
How to keep run Python Program in Background on Raspberry Pi after terminate ssh
i need to keep run my Python Program in Background on my Raspberry Pi after i close the ssh connection, Because i need to save Phidget information on a SQL DB
I try to do this with nohup but it seems ...
1
vote
1answer
16 views
Python: LOAD DATA INFILE mySQL
I try to import data into a mySQL database using Python, but I can't get it to work. I don't get any errors it looks as if everything is working OK, but the text file never gets imported.
I can ...
-4
votes
0answers
21 views
What's is the most suitable CMS framwork for my content management [closed]
I have four tables in mysql, this is not very big. The main table consists of a few properties of a video information, such as url and shortcut. Now I want to do a CMS which can help content operator, ...
0
votes
0answers
16 views
Issue deleting a record from slave table in MySQL DB setup in replication from Django
I have a mysql Database that is setup in replication.
The master has a_table (replicated)
and Slave has a_table (replicated) and b_table (non replicated).
b_table has an attribute that has a foreign ...
0
votes
2answers
41 views
create database by load a csv files using the header as columnnames (and add a column that has the filename as a name)
I have CSV files that I want to make database tables from in mysql. I've searched all over and can't find anything on how to use the header as the column names for the table. I suppose this must be ...
0
votes
1answer
23 views
How do I use mysql-connector-python with MAMP?
Command line mysql works as expected:
mysql --host=localhost --user=django3 --password=django3 \
--database=django3 --port=8889
producing:
...
Server version: 5.5.34 Source distribution
...
...
0
votes
1answer
22 views
Installing pymysql for Python 2.5.1 or lower
it doesn't seem like I can find PyMySQL for python 2.5.1 by searching google. Does anyone have external links.
Where do I download/install PyMySQL for python 2.5.1 or lower?
If it's not possible, ...
0
votes
0answers
23 views
retrieving data from rackspace database through python
I have very little knowledge of rackspace..My client has setup one server at rackspace cloud and saying that he created one database and I have to retrieve data from there , while logging into ...
0
votes
1answer
17 views
combine 2 tables and aggregate data
users
Could you please help with following?
I need to extract data from a mysql database and aggregate them.
There are two tables in the database, both of them have data in a dfferent timestep.
I ...
0
votes
1answer
25 views
Can't import MySQLdb into python
I have followed the steps in the website below, and installed everyhting for MySQLdb.I am using Xampp for the database and I have linked the mysql_config to the xampp mysqlconfig.
...
0
votes
0answers
44 views
Django model changes
I haven't been able to figure out the answer by google-fu, and I'm a little baffled. I'm trying to help a friend get some code up and running and ran into a bit of trouble while trying to change the ...
0
votes
0answers
31 views
How to view /template data from existing db using model in Django
I managed to connect existing mySQL with Django , but when I tried to view in my app. using :
from task.models import stats
data = stats.objects.all()
for e in data:
print e.name, 'starts on', ...
0
votes
0answers
20 views
Python altinstall creating conflict with mysql libraries
I installed Python2.7 on my mediatemple server to be available in paralle to the 2.6 version being used by CentOS. I used these instructions ...
0
votes
1answer
23 views
Python does not commit on insert query
I am trying to bulk insert locations on wordpress. I have defined functions to check and adding terms and taxonomy
def checkTerm(term,con):
cur = con.cursor()
query = "SELECT term_id FROM ...
0
votes
0answers
14 views
Adding objects to multiple databases in Flask-SQLAlchemy Openshift
I am trying to add two separate objects to two databases using SQLAlchemy in a flask application hosted on Openshift. I have two databases joined by a bind using
...
1
vote
0answers
39 views
Adding headers to comma delimited string using Python 3.4
I have a static output from a serial connection which is comma delimited. The incoming data will always have 23 values.
data string from machine:
# "987654321 "," "," ...
1
vote
1answer
40 views
python program in django
I have been working on a problem and currently in a fix. The problem is that I need to transfer data currently in an excel sheet to MySQL database. So far I have been able to get the file on the ...
3
votes
2answers
121 views
Using MySQL table as a queue with threads in Python
I have a DB with a queue table, new entries are inserted continuously in the queue.
I want a Python script to execute the queue as fast as possible, and I think I need some threaded code to do so, ...
1
vote
1answer
34 views
python DELETE rows from mysql with REGEXP and mysql connector
Code setup according to examples found here:
for ICAO_COUNTRY in ['GM','DA','DT']:
table='aerodrome'
query = 'delete from %s where code_icao regexp "%s[A-Z][A-Z]"'
...
0
votes
0answers
19 views
django-celery doesn't work with CONN_MAX_AGE
I am using Django 1.6.5, celery 3.1.13 and django-celery 3.1.10.Django has a new configuration "CONN_MAX_AGE" for database pooling since 1.6, but the problem is, when I config the database without ...
0
votes
0answers
28 views
django performance optimization
I have the following problem:
My employers wanted some fields in the database to have encrypted values. So I used one of django apps (django-encrypted-fields) to have them encrypted. But then came ...
0
votes
0answers
17 views
update mysql using python
I am trying to update record in mysql database using python.
matchob = re.search('(miR[0-9]+)', mir[1])
if matchob:
fam = matchob.group(0) #This is a string
cur.execute("""update eg set ...