0
votes
0answers
8 views

How to write Django model to get record from multiple tables?

class Game(models.Model): total_players = models.IntegerField(max_length=10) created_on = models.DateTimeField(auto_now_add=True) updated_on = models.DateTimeField(auto_now=True) class ...
1
vote
2answers
17 views

SQL datatbase not accepting UTF -8 Characters

I have a python program wherein I access a url and extract data. I then input this data into a mysql table. The mysql table has columns pid ,position,club, points,s,availability, rating,name . I have ...
0
votes
1answer
14 views

Python: Proper way to store list of strings in sqlite3 or mysql

I'm trying to store a list of string values into a sql database. list = ['please','help','me'] I've tried converting to unicode and using the array.array('u',list) unicode_list = unicode(list) ...
0
votes
0answers
12 views

Chinese character encoding issue when adding Scrapy for Python items into MYSQL

I'm trying to get scraped Chinese text into a MYSQL database from python scrapy, but it seems that either scrapy or MYSQL can't handle Chinese characters using my current method. def ...
0
votes
0answers
20 views

Using sqlite to access a database online [on hold]

So in my class we have databases set up online via phpMyAdmin that we're supposed to populate. I've written a Python script that scraped all the data I wanted off the internet and was wondering if it ...
1
vote
0answers
29 views

Python MySQLdb loop

Here is the pseudo code I am trying to achieve; connect to db While True: execute query (SELECT * FROM requests WHERE state = 'NOT_STARTED' foreach row in rows #process each row Here is the code ...
0
votes
2answers
27 views

Python - writing out the result of Popen into a mysql table

Is it possible to write every line, I receive from this script, into a mysql table ? I want to have 2 columns: The ip-adress I need for the command (ipAdresse) and a part of the output of the command ...
1
vote
1answer
30 views

scrapy exceptions.TypeError: 'int' object has no attribute '__getitem__'

When I was in use scrapy collection into Mysql and the have some problems, hope everyone to give solutions, thank you。 pipelines.py type of error: 2013-12-06 18:07:02+0800 [-] ERROR: Unhandled error ...
0
votes
1answer
14 views

How to find the newest entry for each of “n” with sqlalchemy

I'm working on fixing up a forum script of mine, and I want to do what many popular sofwares do and display the latest reply for each board category on the category list. I just can't seem to get ...
0
votes
0answers
9 views

PySQLPool and Celery, proper way to use it?

I am wondering what is the proper way to use the mysql pool with celery tasks. At the moment, this is how (the relevant portion) of my tasks module looks like: from start import celery import ...
1
vote
2answers
30 views

How to store empty value as an Integerfield

I've seen all the similar threads, read the docs, and tried many combinations to store an empty value as IntegerField in db and failed every single time. I am using MySQL. My models.py defines an ...
-1
votes
0answers
24 views

Set Django mysql database to display non-latin characters, such as greek

I have a problem setting mysql db to properly recognise greek characters in django. in my setting.py file I have included the following options: 'OPTIONS': { 'charset': 'utf8', ...
0
votes
2answers
39 views

Generate multiple strings in overage (1000)

I have some trouble with rows generation for mysql in django project! I need to generate 1000 unique rows in a table, looked like : id(int) - auto title(varchar) description (text) Any ideas? Thanks ...
0
votes
1answer
33 views

DatabaseError: (1071, 'Specified key was too long; max key length is 767 bytes')

I have a django project and I would like to run some unit tests. When I try: python manage.py test it throws this error and I couldn't find much information about it in here. my db settings in ...
0
votes
1answer
32 views

Django Multiple Result Sets

I have a stored procedure that i'm calling with cursor.execute in my Django app. The stored procedure returns 2 result sets but I can't seem to access the second one via Django. What is the proper way ...
-5
votes
0answers
32 views

How to get data of two tables python django? [on hold]

pedidos_bd = Pedido.objects.filter(id=4255, pedidoitem__pedido=4255) for pedido in pedidos_bd: temp = u"{0};{1};{2}".format( pedido.data, pedido.fechamento, ...
0
votes
0answers
34 views

python : Unknown MySQL server host '192.12xx.xxx.xxx

I'm in new to python. I can't connect remote server mysql using python. first.py #!/usr/bin/python import MySQLdb import second DBHostname = second.hostname DBuser = second.user DBPWD = ...
0
votes
1answer
22 views

query url from mysql database using Python

I am trying to query a URL address from mysql database so that I can connect using this address and scrape a website. however I get an error Code: cnx = mysql.connector.connect(host=mysql_host, ...
0
votes
1answer
15 views

CRC 32 Mysql and CRC32 python?

i don't known ? help me In mysql i run : SELECT CRC32('test'); result = 3632233996 In python : import zlib print zlib.crc32('test') result = -662733300 please help me!
0
votes
1answer
25 views

SQLalchemy: changes not committing to db (solved)

I am trying to write what should be a relatively simple script using SQLalchemy to interact with a MySQL database. I am pretty new to sqlalchemy, and programming in general, so I am in need of help. ...
0
votes
0answers
11 views

Web2Py DAL, left join and operator precedence

In my DB, I've basically 3 tables: usergroup(id, name, deleted) usergroup_presentation(id, groupid, presentationid) presentation(id, name) I'm trying to run this DAL query: left_join = ...
1
vote
1answer
41 views

pytz and Centos and mysql - django

The admin view of blog objects lists blog objects sorted by date. When the page is open (on development server), this error is returned: Database returned an invalid value in QuerySet.dates(). Are ...
0
votes
1answer
22 views

Django querying a nested list of times Django 1.2

I have a list of objects which form a tree structure through foreign key relationships. parent = models.ForeignKey( 'Category', related_name = 'child_set', null = True ) So each category object has ...
0
votes
1answer
18 views

Celery and mysql connections

What is the appropriate way to handle mysql connections when multiple celery tasks read and write to the same database? Pooling ? If so, is there support for it in mysqldb for python? Thank you
1
vote
1answer
26 views

how to convert from MySQL datetime to numpy datetime64?

I am loading a cursor into a numpy array as a precursor to using pyplot. I have not been successful in converting the datetime field from Mysql into the datetime64 that numpy uses. Python code ...
0
votes
2answers
37 views

Compare two databases and find common value in a row

I have two databases (infact two database dump ... db1.sql and db2.sql) both database have only 1 table in each. in each table there are few columns (not equal number nor type) but 1 or 2 columns ...
0
votes
0answers
23 views

gevent and SQLAlchemy MySQL compatible driver [on hold]

I'm working on a project which relies on gevent for concurrency and needs to work with a MySQL DB. I would like to use SQLAlchemy although I have to say it is not a strict requirement. Using a MySQL ...
0
votes
1answer
30 views

Is it possible to run scripts on django using only ftp?

I am newbie to python and django, but this time I need a fast solution. I've got a problems, using hosting where my django application is deployed so I need to migrate to another server, but I have no ...
0
votes
1answer
39 views

Exception Value: 'DatabaseWrapper' object has no attribute 'Database'

I looked at the similar posts before entering this question. I am using Django 1.5, Python 3.3.2, and MySQL 5.6 / Connector. I am new to Django/Python and working my way through basic tutorial. I ...
1
vote
1answer
21 views

Optimize order by random() in table with lot of records

I am using SQLAlchemy to fetch one random result (from count results I choose only one based on some stuffs/ this cannot be on sql level choosing) which satisfies conditions, my query looks like for ...
0
votes
2answers
26 views

Can't get MySQLDb to work in python on Mac is there other easier DB?

I am looking for a production database to use with python/django for web development. I've installed MySQL successfully. I believe the python connector is not working and I don't know how to make it ...
0
votes
1answer
68 views

Which database to use with Django and Python 3? [closed]

I'm writing my first application with Django and Python 3.3.3. I've always used MySQL for others projects, but it seems to have some problems with Python 3.X and MySQL : At the time of writing, ...
1
vote
2answers
29 views

how to secure mysql connection using python

I'm writing python script which uses a mysql db. I want to secure mysql connection and the database will not be accessible to local user . Is there a good way to product this? #!/usr/bin/python ...
0
votes
0answers
18 views

MySQLdb vs python-mysql_connector [closed]

I recently came across mysql-connector for python. Having used mysqldb previously, I was wondering what difference does mysql-connector possess when compared to mysqldb. Is there any difference in ...
0
votes
0answers
29 views

Web User Profiling using Python [closed]

I want to develop an application, which will generate user profiles based on web serer access log analysis. This profiling will be based on IP address, user-agent string etc. After generating the ...
0
votes
1answer
22 views

Everything works but not adding data to mysql database

I'm trying to add some data to my database. Code works good without error. But when i'm checking my database i see that there is nothing new. Where is error? import MySQLdb as mdb con = #connection ...
1
vote
1answer
35 views

Periodic OperationalError: (2006, 'MySQL server has gone away')

I am hosting a web app at pythonanywhere.com and experiencing a strange problem. Every half-hour or so I am getting the OperationalError: (2006, 'MySQL server has gone away'). However, if I resave my ...
0
votes
2answers
29 views

How can be datetime formatted for mysql?

I want to send date and time from python to mysql. Type of variable in MySQL is datetime. I used year-month-day hour:minutes:seconds, but when i'm compiling it gives error after space (where time part ...
1
vote
1answer
17 views

python mysql multi-row insert fail

i'm just trying to insert data into a small mysql (innodb) table i made for testing. the single row insert works: cursor.execute("insert into testy (one, two) values (%s,%s)", ('00','01')) but ...
0
votes
1answer
23 views

Form can't insert items in MySQL using Python

I'm researching in several forums but can't find the issue in a simple form to insert information in a MySQL database. Can you find the error? Thanks Here's the HTML form code (hello.html): ...
0
votes
1answer
56 views

MySqlDb python, syntax error, can not understand

I have this query self.cursor.execute("""INSERT IGNORE INTO groups ( name, ...
1
vote
1answer
25 views

How to force django to save immediately instead of doing a batch update after loop

I have this django views.py method that aims to insert many data into the db. It loops through arrays of models and, if an object isn't already on the db, it gets inserted. This is what the code ...
0
votes
1answer
30 views

Make a MySQL Connection Over a Proxy

We have a Python script that writes values to a local database. We need to move this database to a remote host that requires the connection come from a white-listed IP address, which we have to set ...
1
vote
1answer
49 views

Django, Truncated incorrect DOUBLE value: '\x00' in ValueQuerySet

When I tried to run the following code, I get the error: Django, Truncated incorrect DOUBLE value: '\x00' I googled and read the solution for this issue I am not able to resolve my issue. I am using ...
-1
votes
2answers
38 views

crawl using scrapy and put the data into an existing mysql database [closed]

What i want to do is to crawl a few stuff from a website and put it into an already created table. I am using mysql and Scrapy for crawling. any help?
0
votes
1answer
18 views

pymysql only detecting changes made externally after instantiating a new connection

I'm trying to run a Python script which leaves a connection open permanently, and responds to changes made outside of the script. So for example: Data script: Accepts form posts and commits form ...
0
votes
2answers
41 views

How to prevent duplicate entries in model from django admin

I have an application having a model called Verifications. It has fields like: asset_code, Status, Location, Emp_id etc. I can add verifications using "Add Verification" from django admin panel. But I ...
0
votes
1answer
46 views

Attribute Error Object has no attribute cleaned_data

my views.py cod: def update_details(request): if request.method == "POST": form = UpdateDetailsForm(request.POST) if form.is_valid: ...
1
vote
1answer
41 views

Only part of long string is written to database with pandas write_frame

I'm writing a pandas DataFrame to a MySql database. Following is how it displays on the screen. IP Agent 0 108.225.156.214 Mozilla/5.0 ...
0
votes
0answers
31 views

Special Characters and Encoding

Although there are hundreds of questions of this kind, there isn't an appropriate answer helping me to understand and solve my problem. I wanted to switch from a SQLite database to a MySQL database ...

15 30 50 per page