Question
stringlengths
25
7.47k
Q_Score
int64
0
1.24k
Users Score
int64
-10
494
Score
float64
-1
1.2
Data Science and Machine Learning
int64
0
1
is_accepted
bool
2 classes
A_Id
int64
39.3k
72.5M
Web Development
int64
0
1
ViewCount
int64
15
1.37M
Available Count
int64
1
9
System Administration and DevOps
int64
0
1
Networking and APIs
int64
0
1
Q_Id
int64
39.1k
48M
Answer
stringlengths
16
5.07k
Database and SQL
int64
1
1
GUI and Desktop Applications
int64
0
1
Python Basics and Environment
int64
0
1
Title
stringlengths
15
148
AnswerCount
int64
1
32
Tags
stringlengths
6
90
Other
int64
0
1
CreationDate
stringlengths
23
23
Problem I have a list of ~5000 locations with latitude and longitude coordinates called A, and a separate subset of this list called B. I want to find all locations from A that are within n miles of any of the locations in B. Structure All of this data is stored in a mysql database, and requested via a python script. A...
0
1
1.2
0
true
20,455,724
0
71
1
0
0
20,455,129
Load B into a python list and for each calculate maxlat, minlat, maxlong, minlong that everything outside of the box is definitely outside of your radius, if your radius is in nautical miles and lat/long in degrees. You can then raise an SQL query for points meeting criteria of minlat < lat < maxlat and minlong < long...
1
0
0
Finding Locations with n Miles of Existing Locations
1
python,mysql,latitude-longitude
0
2013-12-08T15:29:00.000
I can convert date read from excel to a proper date using xldate_as_tuple function. Is there any function which can do the reverse i.e. convert proper date to float which is stored as date in excel ?
2
0
0
0
false
21,302,801
0
1,405
1
0
0
20,464,887
Excel dates are represented as pywintypes.Time type objects. So in order to e.g. assign the current timestamp to a cell you do: workbook.Worksheets(1).Cells(1,1).Value = pywintypes.Time(datetime.datetime.now())
1
0
1
How to convert current date to float which is stored in excel as date?
3
python,excel,xlrd
0
2013-12-09T06:57:00.000
how to do file uploading in turbogears 2.3.1? I am using CrudRestController and tgext.datahelpers and it is uploading the file in the sqlite3 database but in an unknown format. I want to make a copy of the uploaded file in the hard drive. My query is how to ensure that when user uploads a file, it is loaded both in the...
1
0
1.2
0
true
20,525,832
0
226
1
0
0
20,492,587
tgext.datahelpers uploads files on disk inside the public/attachments directory (this can be change with tg.config['attachments_path']). So your file is already stored on disk, only the file metadata, like the URL, filename, thumbnail_url and so on are stored on database in JSON format
1
0
0
file upload turbogears 2.3.1
1
python-2.7,turbogears2
0
2013-12-10T10:57:00.000
I tend to start projects that are far beyond what I am capable of doing, bad habit or a good way to force myself to learn, I don't know. Anyway, this project uses a postgresql database, python and sqlalchemy. I am slowly learning everything from sql to sqlalchemy and python. I have started to figure out models and the ...
1
0
1.2
0
true
20,589,295
0
995
1
0
0
20,587,888
You could use a schema change management tool like liquibase. Normally this is used to keep your database schema in source control, and apply patches to update your schema. You can also use liquibase to load data from CSV files. So you could add a startup.csv file in liquibase that would be run the first time you run l...
1
0
0
Sqlalchemy, python, easiest way to populate database with data
1
python,sql,postgresql,sqlalchemy
0
2013-12-14T20:26:00.000
I am building the back-end for my web app; it would act as an API for the front-end and it will be written in Python (Flask, to be precise). After taking some decisions regarding design and implementation, I got to the database part. And I started thinking whether NoSQL data storage may be more appropriate for my proje...
11
14
1.2
0
true
20,600,546
1
2,835
1
0
0
20,597,590
I'm working at RethinkDB, but that's my unbiased answer as a web developer (at least as unbiased as I can). Flexible schema are nice from a developer point of view (and in your case). Like you said, with something like PostgreSQL you would have to format all the data you pull from third parties (SoundCloud, Facebook e...
1
0
0
How suitable is opting for RethinkDB instead of traditional SQL for a JSON API?
1
python,sql,database,nosql,rethinkdb
0
2013-12-15T17:37:00.000
I am working with an Oracle database with millions of rows and 100+ columns. I am attempting to store this data in an HDF5 file using pytables with certain columns indexed. I will be reading subsets of these data in a pandas DataFrame and performing computations. I have attempted the following: Download the the table, ...
12
0
0
1
false
29,225,626
0
5,171
1
0
0
20,618,523
Okay, so I don't have much experience with oracle databases, but here's some thoughts: Your access time for any particular records from oracle are slow, because of a lack of indexing, and the fact you want data in timestamp order. Firstly, you can't enable indexing for the database? If you can't manipulate the databas...
1
0
0
Reading a large table with millions of rows from Oracle and writing to HDF5
2
python,pandas,hdf5,pytables
0
2013-12-16T18:50:00.000
I dont even know if this is possible. But if it is, can someone give me the broadstrokes on how I can use a Python script to populate a Google spreadsheet? I want to scrape data from a web site and dump it into a google spreadsheet. I can imagine what the Python looks like (scrapy, etc). But does the language support w...
0
0
0
0
false
50,629,830
1
3,149
1
0
0
20,693,168
Yes, it is possible and this is how I am personally doing it so. search for "doGet" and "doPost(e)
1
0
0
Is this possible - Python script to fill a Google spreadsheet?
3
python,google-sheets
0
2013-12-19T22:45:00.000
i have deployed a simple Django application on AWS. The database i use is MySQL. Most parts of this application runs well. But there happens to be a problem when i submitted a form and store data from the form into a model. The error page presents Data truncated for column 'temp' at row 1. temp is a ChoiceField like th...
0
1
1.2
0
true
20,712,349
1
2,106
1
0
0
20,712,174
Your column is only 2 chars wide, but you are trying to store the strings 'HIGH', 'MEDIUM', 'LOW' from your TEMP choices (the first value of each tuple is saved in the database). Increase max_length or choose different values for choices, e.g. TEMP = ( ('H', 'High'), ('M', 'Medium'), ('L', 'Low'), ). It worked fine in...
1
0
0
Data truncated for column 'temp' at row 1
2
python,mysql,database,django,amazon-ec2
0
2013-12-20T21:24:00.000
I'm started enhancing an application which has developed in Python. Zope server has been used to deploy the application. In many modules DB connection has established and used for DB transaction, and which has not used any connection pooling mechanism. Considering the volume of users it is vulnerable to have DB connect...
1
0
0
0
false
21,954,872
0
309
1
0
0
20,798,818
I guess you've advanced with your problem, but this is not a reason not to comment. 1) Long-term answer: seriously consider building a path to migrating to ZODB instead of mysql. ZODB is integrated with Zope and is way more efficient than mysql for storing Zope data. You can't do it at once, but may be you can identify...
1
0
0
How to configure DB connection pooling in Python Zope server
1
python,mysql,connection-pooling,mysql-python,zope
0
2013-12-27T10:15:00.000
I am trying to import sqlalchemy.databases.sqlite.DateTimeMixIn. I get ImportError: No module named sqlite. SQLAlchemy 0.8.4 is installed. If I do import sqlite I get the same error.
0
1
0.099668
0
false
20,835,718
0
79
1
0
0
20,834,740
Sounds like the python binary you are using wasn't compiled with the sqlite module. If you are compiling from source, make sure you have the sqlite headers available.
1
0
0
Importing SQLAlchemy DateTimeMixin raises ImportErrror
2
python,sqlite,sqlalchemy
0
2013-12-30T06:52:00.000
Is there any way to check whether a row in a table has been modified or not in Cassandra. I don't want to compare the date before and after updating row in table. After Update operation I need to verify the query executed properly or not using python scripts. I am using Cassandra Driver for python.
0
0
1.2
0
true
20,928,821
0
167
1
0
0
20,855,659
If you want to verify that an update happened as planned, execute a SELECT against the updated row.
1
0
0
Cassandra row update check in a table
1
python,cassandra
0
2013-12-31T10:15:00.000
I want to publish an Android application that I have developed but have a minor concern. The application will load with a database file (or sqlite3 file). If updates arise in the future and these updates are only targeting the application's functionality without the database structure, I wish to allow users to keep the...
4
0
0
0
false
20,856,571
1
487
2
0
0
20,856,465
if you're using local sqlite then you have to embed the database file within the app as failure to do so it means there's no database, in case for updates database have version numbers where as it can not upgrade the database provided the version number is the same as the previous app updates
1
1
0
Update apk file on Google Play
2
android,python-2.7,sqlite,apk,kivy
0
2013-12-31T11:14:00.000
I want to publish an Android application that I have developed but have a minor concern. The application will load with a database file (or sqlite3 file). If updates arise in the future and these updates are only targeting the application's functionality without the database structure, I wish to allow users to keep the...
4
0
0
0
false
46,767,741
1
487
2
0
0
20,856,465
I had the same issue when I started my app but since kivy has no solution for this I tried to create a directory outside my app directory in android with a simple os.mkdir('../##') and I put all the files there. Hope this helps!
1
1
0
Update apk file on Google Play
2
android,python-2.7,sqlite,apk,kivy
0
2013-12-31T11:14:00.000
I have a Django app that has several database backends - all connected to different instances of Postgresql database. One of them is not guaranteed to be always online. It even can be offline when application starts up. Can I somehow configure Django to use lazy connections? I would like to: Try querying return "sorry...
1
2
0.379949
0
false
21,235,393
1
380
1
0
0
20,878,709
The original confusion is that Django tries to connect to its databases on startup. This is actually not true. Django does not connect to database, until some app tries to access the database. Since my web application uses auth and site apps, it looks like it tries to connect on startup. But its not tied to startup, it...
1
0
0
Lazy psql connection with Django
1
python,django,django-models
0
2014-01-02T08:01:00.000
As the title suggests, I am using the s3cmd tool to upload/download files on Amazon. However I have to use Windows Server and bring in some sort of progress reporting. The problem is that on windows, s3cmd gives me the following error: ERROR: Option --progress is not yet supported on MS Windows platform. Assuming - -n...
1
2
1.2
0
true
21,165,278
1
701
1
0
1
21,017,853
OK, I have found a decent workaround to that: Just navigate to C:\Python27\Scripts\s3cmd and comment out lines 1837-1845. This way we can essentially skip a windows check and print progress on the cmd. However, since it works normally, I have no clue why the authors put it there in the first place. Cheers.
1
0
0
s3cmd tool on Windows server with progress support
2
python,windows,progress-bar,progress,s3cmd
0
2014-01-09T10:38:00.000
I am trying to install psycopg2 on Mac OS X Mavericks but it doesn't see any pg_config file. Postgres was installed via Postgres.app . I found pg_config in /Applications/Postgres.app/Contents/MacOS/bin/ and put it to setup.cfg but still can't install psycopg2. What might be wrong?
2
0
0
0
false
21,414,139
0
916
1
1
0
21,033,198
I had the same problem when I tried to install psycopg2 via Pycharm and using Postgres93.app. The installer (when running in Pycharm) insisted it could not find the pg_config file despite the fact that pg_config is on my path and I could run pg_config and psql successfully in Terminal. For me the solution was to instal...
1
0
0
Can't install psycopg2 on Maverick
1
python,macos,postgresql,psycopg2
0
2014-01-09T23:15:00.000
Recently i m working on web2py postgresql i made few changes in my table added new fields with fake_migration_all = true it does updated my .table file but the two new added fields were not able to be altered in postgres database table and i also tried fake_migration_all = false and also deleted mu .table file but stil...
0
0
0
0
false
21,050,586
1
535
1
0
0
21,046,136
fake_migrate_all doesn't do any actual migration (hence the "fake") -- it just makes sure the metadata in the .table files matches the current set of table definitions (and therefore the actual database, assuming the table definitions in fact match the database). If you want to do an actual migration of the database, t...
1
0
0
Web2py postgreSQL database
1
python,web2py
0
2014-01-10T13:55:00.000
Forgive my ignorance as I am new to oursql. I'm simply trying to pass a parameter to a statement: cursor.execute("select blah from blah_table where blah_field = ?", blah_variable) this treated whatever is inside the blah_variable as a char array so if I pass "hello" it will throw a ProgrammingError telling me that 1 p...
0
1
0.099668
0
false
21,053,569
0
233
1
0
0
21,053,472
IT is expecting a sequence of parameters. Use: [blah_variable]
1
0
0
Python oursql treating a string variable as a char array
2
python,parameters,oursql
0
2014-01-10T20:06:00.000
I am deploying my flask app to EC2, however i get the error in my error.log file once i visit the link of my app. My extensions are present in the site-packages of my flask environment and not the "usr" folder of the server, however it tries to search usr folder to find the hook File "/usr/local/lib/python2.7/dist-pac...
0
0
0
0
false
21,124,613
1
2,246
1
0
0
21,107,967
You should be building your python apps in a virtualenv rather than using the system's installation of python. Try creating a virtualenv for your app and installing all of the extensions in there.
1
0
0
ImportError: No module named flask.ext.sqlalchemy
1
python,deployment,amazon-ec2,flask,flask-sqlalchemy
0
2014-01-14T07:23:00.000
What I am using: PostgreSQL and Python. I am using Python to access PostgreSQL What I need: Receive a automatic notification, on Python, if anyone records something on a specific table on database. I think that it is possible using a routine that go to that table, over some interval, and check changes. But it requires ...
21
17
1.2
0
true
21,128,034
0
17,343
1
0
0
21,117,431
donmage is quite right - LISTEN and NOTIFY are what you want. You'll still need a polling loop, but it's very lightweight, and won't cause detectable server load. If you want psycopg2 to trigger callbacks at any time in your program, you can do this by spawning a thread and having that thread execute the polling loop. ...
1
0
0
How to receive automatic notifications about changes in tables?
3
python,postgresql,events,triggers,listener
0
2014-01-14T15:35:00.000
We have a database that contains personally-identifying information (PII) that needs to be encrypted. From the Python side, I can use PyCrypto to encrypt data using AES-256 and a variable salt; this results in a Base64 encoded string. From the PostgreSQL side, I can use the PgCrypto functions to encrypt data in the sa...
1
3
1.2
0
true
21,128,178
0
2,355
1
0
0
21,122,847
Imagine you have a Social Security Number field in your table. Users must be able to query for a particular SSN when needed. The SSN, obviously, needs to be encrypted. I can encrypt it from the Python side and save it to the database, but then in order for it to be searchable, I would have to use the same salt for ever...
1
0
0
Encryption using Python and PostgreSQL
2
python,postgresql,encryption
1
2014-01-14T20:01:00.000
I have several million rows in a Sqlite database that need 5 columns updated. Each row/column value is different, so I have to update each row individually. Because of the way I'm looping through JSON from an external API, for each row, I have the option of either: 1) do 5 UPDATE operations, one for value. 2) build a ...
1
1
0.197375
0
false
21,150,081
0
71
1
0
0
21,150,012
Building a dict doesn't really take that much memory. It's much more efficient since you'll only need to do one operation - and let SQLite handle it. Well, python is going to clean the dict anyway, so this is definitely the way to go. But as @JoranBeasley mentioned in the comment.. You never know until you try. Hope ...
1
0
1
For a single Sqlite row, faster to do 5 UPDATEs or build a python dict, then 1 Update?
1
python,python-2.7,sqlite
0
2014-01-15T22:55:00.000
I am using Oracle database and in a certain column I need to insert Strings, which in some cases are larger than 4000 symbols (Oracle 11g limits Varchar2 size to 4000). We are required to use Oracle 11g, and I know about the 12g extended mode. I would not like to use the CLOB datatype for performance considerations. Th...
0
1
1.2
0
true
21,238,505
0
820
1
0
0
21,237,645
CLOB or NCLOB would be the best options. Avoid splitting data into columns. What would happen when you have data larger than 2 columns - it will fail again. It also makes it maintenance nightmare. I've seen people split data into rows in some databases just because the database would not support larger character dataty...
1
0
0
SQLAlchemy type containing strings larger than 4000 on Oracle using Varchar2
1
python,oracle,oracle11g,sqlalchemy
0
2014-01-20T15:20:00.000
I have a serious problem, I don't now how to solve it. I have a Win 7 64bit laptop, with MS Office 2007 installed (32 bits). I installed Anaconda 64bits, BUT I am trying to connect to a MS Access MDB file with the ACE drives and I got an error that there is no driver installed. Due to MS Office 2007, I was forced to in...
1
1
1.2
0
true
21,333,377
0
217
1
0
0
21,296,441
I finally got it! Yes, the problem was mixing 32 and 64 bits. I solved the problem installing the Microsoft ACE Drivers 64bits on a MS-DOS console, writting: AccessDatabaseEngine_x64.exe /passive And everything works!
1
0
1
Python on Win 7 64bits error MS Access
2
python,ms-access,ms-office,anaconda
0
2014-01-22T23:39:00.000
I have a big problem here with python, openpyxl and Excel files. My objective is to write some calculated data to a preconfigured template in Excel. I load this template and write the data on it. There are two problems: I'm talking about writing Excel books with more than 2 millions of cells, divided into several shee...
5
4
1.2
0
true
21,352,070
0
5,110
1
0
0
21,328,884
The file size isn't really the issue when it comes to memory use but the number of cells in memory. Your use case really will push openpyxl to the limits at the moment which is currently designed to support either optimised reading or optimised writing but not both at the same time. One thing you might try would be to ...
1
0
0
openpyxl: writing large excel files with python
1
python,excel,openpyxl
0
2014-01-24T09:25:00.000
is it possible to use custom _id fields with Django and MongoEngine? The problem is, if I try to save a string to the _id field it throws an Invalid ObjectId eror. What I want to do is using my own Id's. This never was a problem without using Django because I caught the DuplicateKeyError on creation if a given id was a...
0
6
1.2
0
true
21,498,341
1
2,413
1
0
0
21,370,889
You can set the parameter primary_key=True on a Field. This will make the target Field your _id Field.
1
0
0
custom _id fields Django MongoDB MongoEngine
1
python,django,mongodb,mongoengine
0
2014-01-26T23:51:00.000
I have python 2.7 32 bit running on a Windows 8.1 64 bit machine. I have Access 2013 and a .accdb file that I'm trying to access from python and pyodbc. I can create a 64 bit DSN in the 64 bit ODBC manager. However, when I try to connect to it from python, I get the error: Error: (u'IM002', u'[IM002] [Microsoft][O...
4
2
0.132549
0
false
21,393,854
0
10,567
1
0
0
21,393,558
Trial and error showed that installing the "Access Database Engine" 2007 seemed to create 32-bit ODBC source for Access accdb files.
1
0
0
32 bit pyodbc reading 64 bit access (accdb)
3
python,ms-access,odbc
0
2014-01-27T23:03:00.000
I would like to integrate a Python application and PHP application for data access. I have a Python app and it stores data in its application, now i want to access the data from python database to php application database. For PHP-Python integration which methods are used? Thanks
0
0
0
0
false
21,410,252
0
561
1
0
0
21,399,625
The easiest way to accomplish this is to build a private API for your PHP app to access your Python app. For example, if using Django, make a page that takes several parameters and returns JSON-encoded information. Load that into your PHP page, use json_decode, and you're all set.
1
0
0
Integration of PHP-Python applications
1
php,python,web-services,integration
1
2014-01-28T07:43:00.000
I'm using Flask-Babel for translating string. In some templates I'm reading the strings from the database(postgresql). How can I translate the strings from the database using Flask-Babel?
9
2
0.197375
0
false
22,099,629
1
1,789
1
0
0
21,497,489
It's not possible to use Babel in database translations, as database content is dynamic and babel translations are static (they didn't change). If you read the strings from the database you must save the translations on the database. You can create a translation table, something like (locale, source, destination), and...
1
0
0
translating strings from database flask-babel
2
python,flask,python-babel,flask-babel
0
2014-02-01T11:31:00.000
I'm having trouble in establishing an ideal setup where I can distinguish between production and test environment for my django app. I'm using a postgresql database that stores a relative file path to a s3 bucket after I upload an image. Am I supposed to make a production copy of all the files in the s3 bucket and con...
0
1
1.2
0
true
21,518,701
1
41
1
0
0
21,518,268
Its good to have different settings for production and dev. So you can just create a settings folder and have settings may be prod.py and dev.py. this will let you use diff apps for eg: you actually don't need debug tool bar on prod. And regarding the file, I feel you dont have to worry about the structure as such, ...
1
0
0
How should I set up my dev enviornment for a django app so that I can pull on static s3 files?
1
python,django,mongodb,postgresql,amazon-s3
0
2014-02-03T00:53:00.000
I have a Model class which is part of my self-crafted ORM. It has all kind of methods like save(), create() and so on. Now, the thing is that all these methods require a connection object to act properly. And I have no clue on what's the best approach to feed a Model object with a connection object. What I though of so...
0
1
1.2
0
true
21,651,170
1
76
1
0
0
21,650,889
Here's how I would do: Use a connection pool with a queue interface. You don't have to choose a connection object, you just pick the next on the line. This can be done whenever you need transaction, and put back afterwards. Unless you have some very specific needs, I would use a Singleton class for the database connec...
1
0
0
Getting connection object in generic model class
1
python,database-connection
0
2014-02-08T19:39:00.000
I'm creating a Google App Engine application (python) and I'm learning about the general framework. I've been looking at the tutorial and documentation for the NDB datastore, and I'm having some difficulty wrapping my head around the concepts. I have a large background with SQL databases and I've never worked with any ...
17
13
1.2
0
true
21,658,988
1
7,423
1
1
0
21,655,862
I think you've overcomplicating things in your mind. When you create an entity, you can either give it a named key that you've chosen yourself, or leave that out and let the datastore choose a numeric ID. Either way, when you call put, the datastore will return the key, which is stored in the form [<entity_kind>, <id_o...
1
0
0
Simple explanation of Google App Engine NDB Datastore
2
python,google-app-engine,app-engine-ndb
0
2014-02-09T05:53:00.000
I am just beginning learning Django and working through the tutorial, so sorry if this is very obvious. I have already a set of Python scripts whose ultimate result is an sqlite3 db that gets constantly updated; is Django the right tool for turning this sqlite db something like a pretty HTML table for a website? I ca...
0
1
1.2
0
true
21,768,188
1
1,298
1
0
0
21,767,229
If you care about taking control over every single aspect of how you want to render your data in HTML and serve it to others, Then for sure Django is a great tool to solve your problem. Django's ORM models make it easier for you to read and write to your database, and they're database-agnostic. Which means that you can...
1
0
0
Django and external sqlite db driven by python script
2
python,django,sqlite
0
2014-02-13T22:48:00.000
I am trying to serve up some user uploaded files with Flask, and have an odd problem, or at least one that I couldn't turn up any solutions for by searching. I need the files to retain their original filenames after being uploaded, so they will have the same name when the user downloads them. Originally I did not want ...
0
0
1.2
0
true
21,817,783
1
143
1
0
0
21,807,032
I'm stupid. Right in the Flask API docs it says you can include the parameter attachment_filename in send_from_directory if it differs from the filename in the filesystem.
1
0
0
Is there a way to tell a browser to download a file as a different name than as it exists on disk?
1
python,amazon-s3,flask
0
2014-02-16T03:48:00.000
Maybe I got this wrong: Is there a way to automatically create the target table for a tabledata.insertAll command? If yes please point me in the right direction. If not - what is the best approach to create the tables needed? Check for existing tables on startup and create the ones that does not exist by loading from G...
3
4
1.2
0
true
21,868,123
0
973
1
0
0
21,830,868
There is no way to create a table automatically during streaming, since BigQuery doesn't know the schema. JSON data that you post doesn't have type information -- if there is a field "123" we don't know if that will always be a string or whether it should actually be an integer. Additionally, if you post data that is m...
1
0
0
Auto-create BQ tables for streaming inserts
1
python,google-bigquery
0
2014-02-17T13:51:00.000
I tried to use pymsql with sqlalchemy using this code : from sqlalchemy import create_engine engine = create_engine("mysql+pymsql://root:@localhost/pydb") conn = engine.connect() and this exception is raised here is the full stack trace : Traceback (most recent call last): File "D...
0
0
0
0
false
21,866,204
0
1,686
1
0
0
21,853,660
Drop the : from your connection string after your username. It should instead be mysql+pymsql://root@localhost/pydb
1
0
0
Error when trying to use pymysql with sqlalchemy sre_constants.error: nothing to repeat
2
python,sqlalchemy,pymysql
0
2014-02-18T12:20:00.000
I have created an excel sheet using XLWT plugin using Python. Now, I need to re-open the excel sheet and append new sheets / columns to the existing excel sheet. Is it possible by Python to do this?
1
2
0.197375
0
false
22,414,279
0
8,628
1
0
0
21,856,559
You read in the file using xlrd, and then 'copy' it to an xlwt Workbook using xlutils.copy.copy(). Note that you'll need to install both xlrd and xlutils libraries. Note also that not everything gets copied over. Things like images and print settings are not copied, for example, and have to be reset.
1
0
0
How to append to an existing excel sheet with XLWT in Python
2
python,xlwt
0
2014-02-18T14:20:00.000
I'm sometimes using a TextField to store data with a structure that may change often (or very complex data) into model instances, instead of modelling everything with the relational paradigm. I could mostly achieve the same kind of things using more models, foreignkeys and such, but it sometimes feels more straightforw...
1
3
0.53705
0
false
21,909,779
1
1,302
1
0
0
21,908,068
Storing data as json (whether in text-typed fields, or PostgreSQL's native jsontype) is a form of denormalization. Like most denormalization, it can be an appropriate choice when working with very difficult to model data, or where there are serious performance challenges with storing data fully normalized into entities...
1
0
1
Django & postgres - drawbacks of storing data as json in model fields
1
python,json,django,postgresql
0
2014-02-20T12:38:00.000
I have a django app which provides a rest api using Django-rest-framework. The API is used by clients as expected, but I also have another process(on the same node) that uses Django ORM to read the app's database, which is sqlite3. Is it better architecture for the process to use the rest api to interact(only reads) wi...
0
0
0
0
false
21,914,906
1
138
1
0
0
21,912,993
It depends on what your application is doing. If your REST application reads a piece of data from SQLITE using the Django ORM and then the other app does a write you can run into some interesting race situations. To prevent that it might make sense to have both these applications as django-app in a single Django proj...
1
0
0
SOA versus Django ORM with multiple processes
1
python,django,sqlite,rest,orm
0
2014-02-20T15:57:00.000
I am trying to design an app that uses Google AppEngine to store/process/query data that is then served up to mobile devices via Cloud Endpoints API in as real time as possible. It is straight forward enough solution, however I am struggling to get the right balance between, performance, cost and latency on AppEngine. ...
1
0
0
0
false
21,962,823
1
173
1
1
0
21,941,030
First, writes to the datastore take milliseconds. By the time your user hits the refresh button (or whatever you offer), the data will be as "real-time" as it gets. Typically, developers become concerned with real-time when there is a synchronization/congestion issue, i.e. each user can update something (e.g. bid on an...
1
0
0
AppEngine real time querying - cost, performance, latency balancing act and quotas
2
python,google-app-engine,mapreduce,task-queue
0
2014-02-21T17:23:00.000
Going through Django tutorial 1 using Python 2.7 and can't seem to resolve this error: OperationalError: no such table: polls_poll This happens the moment I enter Poll.objects.all() into the shell. Things I've already tried based on research through the net: 1) Ensured that 'polls' is listed under INSTALLED_APPS in set...
5
11
1.2
0
true
23,184,956
1
13,012
1
0
0
21,976,383
I meet the same problem today and fix it I think you miss some command in tutorial 1 just do follow: ./python manage.py makemigrations polls python manage.py sql polls ./python manage.py syncdb then fix it and gain the table polls and you can see the table created you should read the "manage.py makemigrations" command
1
0
0
Django Error: OperationalError: no such table: polls_poll
4
python,django,shell,sqlite
0
2014-02-23T23:49:00.000
I have a csv file with about 280 columns, which are possibly changing from time to time. Is there a way to import a csv file to sqlite3 and have it 'guess' the column types? I am using a python script to import this.
2
0
0
0
false
22,005,726
0
1,025
1
0
0
22,004,809
make headers of the columns in csv as the same column names in sqlite3 table. Then directly read and check the type by using type() before inserting into DB.
1
0
0
csv import sqlite3 without specifying column types
2
python,csv,sqlite
0
2014-02-25T04:44:00.000
On OS X 10.9 and 10.9.1, the cx_Oracle works OK. But after I updated my system to OS X 10.9.2 yesterday, it cannot work. When connecting to Oracle database, DatabaseError is raised. And the error message is: ORA-21561: OID generation failed Can anyone help me?
2
0
0
0
false
39,339,545
0
1,020
2
0
0
22,060,338
I haven't seen this on OS X but the general Linux solution is to add your hostname to /etc/hosts for the IP 127.0.0.1.
1
0
0
cx_Oracle can't connect to Oracle database after updating OS X to 10.9.2
2
python,macos,oracle
0
2014-02-27T06:04:00.000
On OS X 10.9 and 10.9.1, the cx_Oracle works OK. But after I updated my system to OS X 10.9.2 yesterday, it cannot work. When connecting to Oracle database, DatabaseError is raised. And the error message is: ORA-21561: OID generation failed Can anyone help me?
2
0
0
0
false
41,649,509
0
1,020
2
0
0
22,060,338
This can be fixed with a simple edit to your hosts file. Find the name of your local-machine by running hostname in your local-terminal $hostname Edit your local hosts file $vi /etc/hosts assuming $hostname gives local_machine_name append it to your localhost , 127.0.0.1 localhost local_machine_name press...
1
0
0
cx_Oracle can't connect to Oracle database after updating OS X to 10.9.2
2
python,macos,oracle
0
2014-02-27T06:04:00.000
I'm using Amazon Linux AMI release 2013.09. I've install virtualenv and after activation then I run pip install mysql-connector-python, but when I run my app I get an error: ImportError: No module named mysql.connector. Has anyone else had trouble doing this? I can install it outside of virtualenv and my script runs wi...
35
3
0.042831
0
false
44,177,264
0
73,109
1
0
0
22,100,757
Also something that can go wrong: Don't name your own module mysql import mysql.connector will fail because the import gives the module in the project precedence over site packages and yours likely doesnt have a connector.py file.
1
0
1
Can not get mysql-connector-python to install in virtualenv
14
python,mysql
0
2014-02-28T16:37:00.000
I know that Redis have 16 databases by default, but what if i need to add another database, how can i do that using redis-py?
1
0
0
0
false
22,111,910
0
460
1
0
0
22,110,562
You cannot. The number of databases is not a dynamic parameter in Redis. You can change it by updating the Redis configuration file (databases parameter) and restarting the server. From a client (Python or other), you can retrieve this value using the "GET CONFIG DATABASES" command. But the "SET CONFIG DATABASES xxx" c...
1
0
0
Insert a new database in redis using redis.StrictRedis()
1
python,database,redis,redis-py
0
2014-03-01T05:29:00.000
I'd rather just use raw MySQL, but I'm wondering if I'm missing something besides security concerns. Does SQLAlchemy or another ORM handle scaling any better than just using pymysql or MySQLdb?
0
1
0.099668
0
false
22,128,680
1
941
2
0
0
22,128,419
SQL Alchemy is generally not faster (esp. as it uses those driver to connect). However, SQL Alchemy will help you structure your data in a sensible way and help keep the data consistent. Will also make it easier for you to migrate to a different db if needed.
1
0
0
Should I use an ORM like SQLAlchemy for a lightweight Flask web service?
2
python,sqlalchemy,flask,flask-sqlalchemy
0
2014-03-02T13:49:00.000
I'd rather just use raw MySQL, but I'm wondering if I'm missing something besides security concerns. Does SQLAlchemy or another ORM handle scaling any better than just using pymysql or MySQLdb?
0
1
1.2
0
true
22,134,840
1
941
2
0
0
22,128,419
Your question is too open to anyone guarantee SQLAlchemy is not a good fit, but SQLAlchemy probably will never be your problem to handle scalability. You'll have to handle almost the same problems with or without SQLAlchemy. Of course SQLAlchemy has some performance impact, it is a layer above the database driver, but ...
1
0
0
Should I use an ORM like SQLAlchemy for a lightweight Flask web service?
2
python,sqlalchemy,flask,flask-sqlalchemy
0
2014-03-02T13:49:00.000
I would like for a user, without having to have an Amazon account, to be able to upload mutli-gigabyte files to an S3 bucket of mine. How can I go about this? I want to enable a user to do this by giving them a key or perhaps through an upload form rather than making a bucket world-writeable obviously. I'd prefer to ...
0
0
0
0
false
22,162,436
1
141
1
0
0
22,160,820
This answer is relevant to .Net as language. We had such requirement, where we had created an executable. The executable internally called a web method, which validated the app authenticated to upload files to AWS S3 or NOT. You can do this using a web browser too, but I would not suggest this, if you are targeting big...
1
0
0
user upload to my S3 bucket
2
python,file-upload,amazon-web-services,amazon-s3
0
2014-03-04T00:59:00.000
I've a bit of code that involves sending an e-mail out to my housemates when it's time to top up the gas meter. This is done by pressing a button and picking whoever's next from the database and sending an email. This is open to a lot of abuse as you can just press the button 40 times and send 40 emails. My plan was to...
0
0
0
0
false
22,181,923
1
76
2
0
0
22,178,513
I asked about a soft button earlier. If your computer program is password/access protected you could just store it all in a pickle/config file somewhere, I am unsure what the value of the sql file is: use last_push = time.time() and check the difference to current push if seconds difference less than x do not progress,...
1
0
0
Check time since last request
2
python
1
2014-03-04T17:13:00.000
I've a bit of code that involves sending an e-mail out to my housemates when it's time to top up the gas meter. This is done by pressing a button and picking whoever's next from the database and sending an email. This is open to a lot of abuse as you can just press the button 40 times and send 40 emails. My plan was to...
0
0
0
0
false
22,179,026
1
76
2
0
0
22,178,513
If this is the easiest solution for you to implement, go right ahead. Worst case scenario, it's too slow to be practical and you'll need to find a better way. Any other scenario, it's good enough and you can forget about it. Honestly, it'll almost certainly be efficient enough to serve your purposes. The number of user...
1
0
0
Check time since last request
2
python
1
2014-03-04T17:13:00.000
I sometimes run python scripts that access the same database concurrently. This often causes database lock errors. I would like the script to then retry ASAP as the database is never locked for long. Is there a better way to do this than with a try except inside a while loop and does that method have any problems?
0
0
0
0
false
22,222,873
0
619
1
0
0
22,191,236
If you are looking for concurrency, SQlite is not the answer. The engine doesn't perform good when concurrency is needed, especially when writing from different threads, even if the tables are not the same. If your scripts are accessing different tables, and they have no relationships at DB level (i.e. declared FK's), ...
1
0
1
Sqlite3 and Python: Handling a locked database
2
python,sqlite
0
2014-03-05T07:23:00.000
Inside an web application ( Pyramid ) I create certain objects on POST which need some work done on them ( mainly fetching something from the web ). These objects are persisted to a PostgreSQL database with the help of SQLAlchemy. Since these tasks can take a while it is not done inside the request handler but rather o...
1
0
0
0
false
22,247,025
1
2,062
1
0
0
22,245,407
This comes close to your second solution: Create a buffer, drop the ids from your zeromq messages in there and let you worker poll regularly this id-pool. If it fails retrieving an object for the id from the database, let the id sit in the pool until the next poll, else remove the id from the pool. You have to deal som...
1
0
0
ZeroMQ is too fast for database transaction
2
python,postgresql,sqlalchemy,zeromq
1
2014-03-07T08:48:00.000
I am using mongodb 2.4.6 and python 2.7 .I have frequent executing queries.Is it possible to save the frequent qaueries results in cache.? Thanks in advance!
0
1
1.2
0
true
22,251,094
0
1,377
1
0
0
22,250,987
Yes but you will need to make one, how about memcached or redis? However as a pre-cautionary note, MongoDB does have its recently used data cached to RAM by the OS already so unless you are doing some really resource intensive aggregation query or you are using the results outside of your working set window you might n...
1
0
1
How to cache Mongodb Queries?
1
mongodb,python-2.7,caching
0
2014-03-07T13:09:00.000
Introduction I am working on a GPS Listener, this is a service build on twisted python, this app receive at least 100 connections from gps devices, and it is working without issues, each GPS send data each 5 seconds, containing positions. ( the next week must be at least 200 gps devices connected ) Database I am using ...
0
1
1.2
0
true
22,409,012
1
270
1
0
0
22,256,760
Databases do not just lose data willy-nilly. Not losing data is pretty much number one in their job description. If it seems to be losing data, you must be misusing transactions in your application. Figure out what you are doing wrong and fix it. Making and breaking a connection between your app and pgbouncer for each...
1
0
0
Right way to manage a high traffic connection application
1
python,database,postgresql,gps,twisted
0
2014-03-07T17:28:00.000
I use driving_distance function in pgRouting to work with my river network. There are 12 vertices in my river network, and I want to get the distance between all of these 12 vertices, starting from vertex_id No.1. The result is fine, but I want to get other results using other vertices as starting point. I know it woul...
0
1
1.2
0
true
22,392,600
0
684
1
0
0
22,279,499
pyscopg2 Is an excellent python module that allows your scripts to connect to your postgres database and run SQL whether as inputs or as fetch queries. You can have python walk through the number of possible combinations between vertices and have it build the individual SQL queries as strings. It can then run through t...
1
0
0
How to use python to loop through all possible results in postgresql?
1
python,postgresql,pgrouting
0
2014-03-09T07:23:00.000
Unfortunately I have a REHL3 and Python 2.3 and no chance of upgrading. Does anyone have any examples of how to interact with the DB, openning sqlplus, logging in and then I only want a simple SELECT query bring the data to a CSV and then I can figure out the rest. Any ideas please?
0
0
0
0
false
23,064,270
0
319
1
0
0
22,300,744
I used a bash script to produce the csv file and then manipulated the data with Python. That was the only solution I could think of with Python 2.3.
1
0
0
Simple query to Oracle SQL using Python 2.3
1
sql,oracle,shell,oracle10g,python-2.x
0
2014-03-10T12:56:00.000
I'm trying to determine the best practices for storing and displaying user input in MongoDB. Obviously, in SQL databases, all user input needs to be encoded to prevent injection attacks. However, my understanding is that with MongoDB we need to be more worried about XSS attacks, so does user input need to be encoded on...
7
4
1.2
0
true
22,315,740
1
2,232
1
0
0
22,312,452
Does this need to be escaped to "&lt;script&gt;alert(&#x27;hi&#x27;);&lt;&#x2F;script&gt;" before sending it to the server? No, it has to be escaped like that just before it ends up in an HTML page - step (5) above. The right type of escaping has to be applied when text is injected into a new surrounding context. That...
1
0
1
Encoding user input to be stored in MongoDB
2
javascript,python,ajax,mongodb,unicode
0
2014-03-10T22:12:00.000
building bsddb3-6.0.1, Python 3.3.2, BerkeleyDB 5.3, Windows7. First linker asked for libdb53s.lib, but there's no such file, so I deleted 's' symbol (in setup3.py) and now linker can find libdb53.lib, but... _bsddb.obj : error LNK2019: unresolved external symbol db_create referenced in f unction newDBObject _bsddb.o...
2
0
0
0
false
22,391,487
0
183
1
0
0
22,373,983
Deleting the 's' symbol isn't appropriate - the s designates the static libdb53 library. Assuming you are building libdb53 from source as well, in the build_windows directory there is a Berkeley_DB.sln that includes Static_Debug and Static_Release configurations that will build these. However, your troubles may not en...
1
0
0
bsddb3-6.0.1 Windows7 bulid error: _bsddb.obj : error LNK2019: unresolved external symbol db_create referenced in function newDBObject
1
python,windows,berkeley-db,bsddb
0
2014-03-13T09:18:00.000
I keep seeing what appears to be a partly-commited transaction using innodb tables: all my tables use innodb as a backend mysql version: 5.5.31-0ubuntu0.13.04.1-log python web application based on uwsgi, each http request is wrapped in a separate transaction that is either commited or rolled back depending on whethe...
0
0
0
0
false
22,668,180
0
73
1
0
0
22,389,675
It took me a while but it appears that the transaction was automatically rolled back by error 1213 (deadlock) and 1205 (lock wait timeout exceeded). It did not help that these errors were caught in some internal middleware that tried to execute again the statement that failed instead of forwarding the error up to the t...
1
0
0
mysql transaction commited only partly
1
python,mysql,sqlalchemy
0
2014-03-13T20:03:00.000
I am using MySQLdb in python 3 to insert multiple rows using executemany. Now I need to get the primary keys after the multi insert.. Is there any way to get them?
3
3
1.2
0
true
22,399,907
0
591
2
0
0
22,399,825
You can use connection.insert_id()
1
0
0
Get primary keys inserted after executemany
2
python,mysql
0
2014-03-14T08:36:00.000
I am using MySQLdb in python 3 to insert multiple rows using executemany. Now I need to get the primary keys after the multi insert.. Is there any way to get them?
3
1
0.099668
0
false
22,399,968
0
591
2
0
0
22,399,825
When you use executemany you insert multiple rows at a time. You will get first inserted rows primery key using connection.inster_id() To get all inserted ids, you have to run another query.
1
0
0
Get primary keys inserted after executemany
2
python,mysql
0
2014-03-14T08:36:00.000
I have list of nested Json objects which I want to save into cassandra (1.2.15). However the constraint I have is that I do not know the column family's column data types before hand i.e each Json object has got a different structure with fields of different datatypes. So I am planning to use dynamic composite type for...
1
2
0.379949
1
false
22,519,952
0
1,459
1
0
0
22,437,058
If you don't need to be able to query individual items from the json structure, just store the whole serialized string into one column. If you do need to be able to query individual items, I suggest using one of the collection types: list, set, or map. As far as typing goes, I would leave the value as text or blob and...
1
0
0
Import nested Json into cassandra
1
java,python,json,cassandra,cassandra-cli
0
2014-03-16T12:51:00.000
I want to convert a csv file to a db (database) file using python. How should I do it ?
0
0
1.2
0
true
22,443,606
0
933
1
0
0
22,443,297
I don't think this can be done in full generality without out-of-band information or just treating everything as strings/text. That is, the information contained in the CSV file won't, in general, be sufficient to create a semantically “satisfying” solution. It might be good enough to infer what the types probably are ...
1
0
0
How do I convert a .csv file to .db file using python?
2
python,linux,database,sqlite
0
2014-03-16T21:31:00.000
I made a script that opens a .xls file, writes a few new values in it, then saves the file. Later, the script opens it again, and wants to find the answers in some cells which contain formulas. If I call that cell with openpyxl, I get the formula (ie: "=A1*B1"). And if I activate data_only, I get nothing. Is there a wa...
13
1
0.033321
0
false
22,486,256
0
24,869
1
0
0
22,451,973
No, and in openpyxl there will never be. I think there is a Python library that purports to implements an engine for such formualae which you can use.
1
0
0
Calculating Excel sheets without opening them (openpyxl or xlwt)
6
python,excel,xlwt,openpyxl,pyxll
0
2014-03-17T10:31:00.000
I'm using Django 1.6 with PostgreSQL and I want to use a two different Postgres users - one for creating the initial tables (syncdb) and performing migrations, and one for general access to the database in my application. Is there a way of doing this?
3
1
0.197375
0
false
22,527,486
1
78
1
0
0
22,523,519
From ./manage.py help syncdb: --database=DATABASE Nominates a database to synchronize. Defaults to the "default" database. You can add another database definition in your DATABASES configuration, and run ./manage.py syncdb --database=name_of_database_definition. You might want to create a sm...
1
0
0
Different Postgres users for syncdb/migrations and general database access in Django
1
python,django,postgresql
0
2014-03-20T04:28:00.000
Is it possible to call Python within an Oracle procedure? I've read plenty of literature about the reverse case (calling Oracle SQL from Python), but not the other way around. What I would like to do is to have Oracle produce a database table, then I would like to call Python and pass this database table to it in a Dat...
18
0
0
0
false
53,431,165
0
12,854
1
0
0
22,564,503
kind of complicated but possible. I have seen it once. You need to create a javaclass inside oracle database. This class calls a .py file in the directory which contains it. create a procedure that calls the java class of item 1. in your sql query, call the procedure of item 2 whenever you need it.
1
0
0
Calling Python from Oracle
7
python,sql,oracle,pandas,cx-oracle
0
2014-03-21T16:40:00.000
insert_query = u""" INSERT INTO did_you_know ( name, to_be_handled, creator, nominator, timestamp) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}') """.format("whatever", "whatever", "whatever", "whatever", "whatever") is my example. Does every single value in a MySQL query have to contain quotes?...
0
0
0
0
false
22,600,910
0
55
1
0
0
22,600,861
You need to quote only character and other non-integer data types. Integer data types need not be quoted.
1
0
0
Does every single value in a MySQL query have to be quoted?
3
python,mysql,mysql-python
0
2014-03-24T04:01:00.000
so I am new to both programming and Python, but I think I have the issue narrowed down enough to ask a meaningful question. I am trying to use MySQLdb on my computer. No problem, right? I just enter: import PyMySQL PyMySQL.install_as_MySQLdb() import MySQLdb At the top of the script. But here is the problem. I installe...
1
2
0.379949
0
false
24,050,784
0
7,318
1
0
0
22,602,065
You don't need to uninstall anaconda. In your case, Try pip install PyMySql. If which pip return /Users/vincent/anaconda/bin/pip, this should work.
1
0
1
ImportError: No module named PyMySQL - issues connecting with Anaconda
1
python,compatibility,mysql-python,anaconda
0
2014-03-24T05:56:00.000
I am working on a Python/Django application. The core logic rests in a Python application, and the web UI is taken care of by Django. I am planning on using ZMQ for communication between the core and UI apps. I am using a time-series database, which uses PostgreSQL in the background to store string data, and another t...
1
1
0.099668
0
false
22,664,876
1
759
1
0
0
22,662,456
use postgreSQL, our team worked with sqlite3 for a long time. However, when you import data to db,it often give the information 'database is locked!' The advantages of sqlite3 it is small,as you put it, no server setup needed max_length in models.py is not strictly, you set max_length=10, if you put 100 chars in the f...
1
0
0
Database engine choice for Django/ Python application
2
python,database,django,sqlite,postgresql
0
2014-03-26T13:26:00.000
I'm making a Django app with the Two Scoops of Django template. Getting this Heroku error, are my Postgres production settings off? OperationalError at / could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? Exception Locat...
3
5
1.2
0
true
22,693,845
1
1,923
1
0
0
22,674,128
Have you set your DJANGO_SETTINGS_MODULE environment variable? I believe what is happening is this: by default Django is using your local.py settings, which is why it's trying to connect on localhost. To make Django detect and use your production.py settings, you need to do the following: heroku config:set DJANGO_SETTI...
1
0
0
Can't get Django/Postgres app settings working on Heroku
1
python,django,postgresql,heroku
0
2014-03-26T22:12:00.000
What is the code sintax to import an excel file to an MS access database IN PYTHON ? I have already tried making it a text file but with no sucesss
0
0
0
0
false
22,695,473
0
993
1
0
0
22,695,359
In Access select "External Data" then under "Import & Link" select Excel. You should be able to just use the wizard to choose the Excel file and import the data to a new table.
1
0
0
Import Excel spread sheet into Access
2
excel,python-2.7,ms-access-2010
0
2014-03-27T17:47:00.000
I'm using a flask on an ec2 instance as server, and on that same machine I'm using that flask talking to a MongoDB. For the ec2 instance I only leaves port 80 and 22 open, without leaving the mongo port (27017) because all the clients are supposed to talk to the flask server via http calls. Only in the flask I have co...
1
2
0.197375
0
false
22,716,431
1
182
2
0
0
22,715,888
EC2 security policies by default block all incoming ports except ones you have sanctioned, as such the firewall will actually stop someone from getting directly to your MongoDB instance; as such yes it is secure enough. Since the instances are physically isolated there is no chance of the problems you would get on shar...
1
0
0
Security concerning MongoDB on ec2?
2
python,mongodb,security,amazon-web-services,amazon-ec2
0
2014-03-28T14:39:00.000
I'm using a flask on an ec2 instance as server, and on that same machine I'm using that flask talking to a MongoDB. For the ec2 instance I only leaves port 80 and 22 open, without leaving the mongo port (27017) because all the clients are supposed to talk to the flask server via http calls. Only in the flask I have co...
1
2
1.2
0
true
22,716,299
1
182
2
0
0
22,715,888
Should be secure enough. If I understand correctly, you don't have ports 27017 open to the world, i.e. you have (or should)block it thru your aws security group and perhaps your local firewall on the ec2 instance, then the only access to that port will be from calls originating on the same server. Nothing is 100% secur...
1
0
0
Security concerning MongoDB on ec2?
2
python,mongodb,security,amazon-web-services,amazon-ec2
0
2014-03-28T14:39:00.000
I am building a web crawler in Python using MongoDB to store a queue with all URLs to crawl. I will have several independent workers that will crawl URLs. Whenever a worker completes crawling a URL, it will make a request in the MongoDB collection "queue" to get a new URL to crawl. My issue is that since there will be...
0
0
1.2
0
true
22,738,408
0
510
1
0
1
22,737,982
Since reads in MongoDB are concurrent I completely understand what your saying. Yes, it is possible for two workers to pick the same row, amend it and then re-save it overwriting each other (not to mention wasted resources on crawling). I believe you must accept that one way or another you will lose performance, that i...
1
0
0
Multiple workers getting information from a single MongoDB queue
1
python,mongodb,queue,mongodb-query,worker
0
2014-03-29T22:55:00.000
Hi Everyone Ive hit a road block in sql. Its the dreaded storing images in sql database. Apparently the solution to this is to store image in a file system. Does anyone know any book or video tutorial that teaches this I cant seem to find any in the web. Im using My Sql and Python to learn how to work with images. I c...
0
1
1.2
0
true
22,750,529
0
67
1
0
0
22,750,497
Store the image as a file, and store the path of the file in the database. The fact that the file is an image is irrelevant. If you want a more specific answer, you will need to ask a more specific question. Also, please edit your title so that it corresponds to the question.
1
0
0
Sql Filesystem programming Python
1
python,sql,database,image
0
2014-03-30T22:06:00.000
I'm using xlwt to create tables in excel. In excel there is a feature format as table which makes the table have an automatic filters for each column. Is there a way to do it using python?
9
8
1.2
0
true
22,837,578
0
10,141
1
0
0
22,831,520
OK, after searching the web, I realized that with xlwt it's not possible to do it, but with XlsxWriter it's possible and very easy and convenient.
1
0
0
how to do excel's 'format as table' in python
3
python,excel,python-2.7,xlwt
0
2014-04-03T08:10:00.000
I'm just about getting started on deploying my first live Django website, and I'm wondering how to set the Ubuntu server file permissions in the optimal way for security, whilst still granting the permissions required. Firstly a question of directories: I'm currently storing the site in ~/www/mysite.com/{Django apps}, ...
4
1
0.197375
0
false
24,634,526
1
1,003
1
0
0
22,872,888
In regards to serving the application from your home directory, this is primarily preference based. However, deployment decisions may be made depending on the situation. For example, if you have multiple users making use of this server to host their website, then you would likely have the files served from their home d...
1
0
0
Security optimal file permissions django+apache+mod_wsgi
1
python,django,apache,security,permissions
0
2014-04-04T20:58:00.000
I'm writing a little chatserver and client. There I got the idea to let users connect (nice :D) and when they want to protect their account by a password, they send /password <PASS> and the server will store the account information in a sqlite database file, so only users, who know the passphrase, are able to use the n...
0
0
1.2
0
true
24,468,686
0
85
1
0
0
22,886,350
OK, I'm using a simple JSON text file with automatic saving every minute
1
0
0
python simple data storage
1
python,multithreading,sqlite
0
2014-04-05T20:26:00.000
I wrote a migration script which works fine on sqlite, but if i try to apply the same to postgres it is stuck forever. With a simple ps i can see the postres stuck on "create table waiting". There are any best practice?
20
2
0.099668
0
false
22,896,742
0
10,633
2
0
0
22,896,496
your database is most likely locked by another query. Especially if you do stuff with their GUI pgAdmin, this can happen a lot I found. (truncating tables is especially tricky, sometimes pgAdmin crashes and the db gets stuck) what you want to do is to restart the complete postgresql service and try again. Make sure tha...
1
0
0
Alembic migration stuck with postgresql?
4
python,postgresql,alembic
0
2014-04-06T16:08:00.000
I wrote a migration script which works fine on sqlite, but if i try to apply the same to postgres it is stuck forever. With a simple ps i can see the postres stuck on "create table waiting". There are any best practice?
20
3
0.148885
0
false
35,921,043
0
10,633
2
0
0
22,896,496
You can always just restart postgresql.
1
0
0
Alembic migration stuck with postgresql?
4
python,postgresql,alembic
0
2014-04-06T16:08:00.000
I am facing a problem while installing cx_Oracle module. I have installed Oracle Sql developer using which I can connect to any Oracle Server. I have also installed cx_oracle module. Now when I try to import the module I am reciving below mentioned error. import cx_Oracle Traceback (most recent call last): File "", ...
0
1
0.099668
0
false
25,801,626
0
112
1
0
0
22,943,247
You will need C-language based Oracle "client" libraries installed on your local machine. (SQL Developer uses Java libraries). To connect to a remote database you can install the Oracle Instant Client.
1
0
0
Error while importing cx_Oracle on windows
2
python-2.7,cx-oracle
0
2014-04-08T16:43:00.000
I am new to python. Could someone help me to figure out how to execute following commands using cx_Oracle in python? Spool C:\drop_tables.sql SELECT 'DROP TABLE ' || table_name || ' CASCADE CONSTRAINTS;' FROM user_tables; Spool off @C:\drop_tables.sql I know I can use cursor.execute() for 2nd command but for other n...
1
1
1.2
0
true
22,962,131
0
912
1
0
0
22,945,637
So I achieved what I need by following way cur.execute("SELECT table_name FROM user_tables") result = cur.fetchall() for row in result: cur.execute('DROP TABLE ' + row[0] + ' CASCADE CONSTRAINTS')* Thanks much Luke for your idea.
1
0
0
How to execute non sql commands in python using cx_Oracle
1
python,cx-oracle
0
2014-04-08T18:43:00.000
I'm trying to store user data for a website in Python I'm making. Which is more efficient: -Storing all the user data in one huge table -Storing all the user data in several tables, one per user, in one database. -Storing each user's data in a XML or JSON file, one file per user. Each file has a unique name based on ...
0
1
0.197375
0
false
22,951,848
1
242
1
0
0
22,951,806
I don't think efficiency should be part of your calculus. I don't like either of your proposed designs. One table? That's not normalized. I don't know what data you're talking about, but you should know about normalization. Multiple copies? That's not scalable. Every time you add a user you add a table? Sounds lik...
1
0
1
Storing user data in one big database or in a different file for each user - which is more efficient?
1
python,json,database,performance,security
0
2014-04-09T02:39:00.000
So I have a sqlite3 db, which I access from Python (2.7), where I would like to store more than the by default allowed 2.000 columns. I understand that there is a setting or command, SQLITE_MAX_COLUMN, which I can alter, so that my database can store up to ~32.000 columns. My question is how do I in practice set the ma...
1
2
1.2
0
true
22,964,138
0
1,019
1
0
0
22,964,033
That's a compile-time parameter for SQLite itself. As in, you'll need to recompile the SQLite library in order to change it. Nothing you can do in Python will be able to overcome this.
1
0
0
How to actually change the maximum number of columns in SQLITE
1
python-2.7,sqlite,max
0
2014-04-09T13:27:00.000
I have a script running continuously (using a for loop and time.sleep). It performs queries on models after loading Django. Debug is set to False in Django settings. However, I have noticed that the process will eat more and more memory. Before my time.sleep(5), I have added a call to django.db.reset_queries(). The ver...
3
4
1.2
0
true
23,063,519
1
801
1
0
0
22,976,981
After running a debugger, indeed, reset_queries() is required for a non-web python script that uses Django to make queries. For every query made in the while loop, I did find its string representation appended to ones of the queries list in connections.all(), even when DEBUG was set as False.
1
0
0
Is django.db.reset_queries required for a (nonweb) script that uses Django when DEBUG is False?
1
python,django,memory-leaks,daemon
0
2014-04-10T01:25:00.000
I need to store anonymous form data (string, checkbox, FileUpload,...) for a Conference registration site, but ATContentTypes seems to me a little bit oversized. Is there a lightweight alternative to save the inputs - SQL and PloneFormGen are not an option I need to list, view and edit the data inputs in the backend.....
2
0
0
0
false
22,986,589
1
153
1
0
0
22,985,483
One approach is to create a browser view that accepts and retrieves JSON data and then just do all of the form handling in custom HTML. The JSON could be stored in an annotation against the site root, or you could create a simple content type with a single field for holding the JSON and create one per record. You'll ne...
1
0
0
Plone store form inputs in a lightweight way
3
python,forms,plone
0
2014-04-10T10:33:00.000
folks. I'm very new to coding and Python. This is my second Stack question ever. Apologies if I'm missing the obvious. But, I've researched this and am still stuck. I've been trying to install and use mod_wsgi on CentOS 6.5 and am getting an error when trying to add a VirtualHost to Apache. The mod_wsgi install seemed ...
0
1
0.197375
0
false
23,104,951
1
1,164
1
0
0
22,992,857
I think I figured the out. I needed to load the module and define the VirtualHost in the same include file. I was trying to load in the first include file and define the VirtualHost in the second. Putting them both in one file kept the error from happening.
1
0
0
mod_wsgi Error on CentOS 6.5
1
python,linux,apache,mod-wsgi
0
2014-04-10T15:48:00.000
How do you set the header/footer height in openpyxl? I don't find a setting for it. In a spreadsheet there are settings for height and autofit height but I don't see a means for setting either of those in openpyxl.
0
0
0
0
false
23,135,653
0
563
1
0
0
23,068,670
Look at the HeaderFooter class in the worksheet section of the code.
1
0
0
how to set the header/footer height in openpyxl
1
python,openpyxl
0
2014-04-14T19:32:00.000
I'm trying to stop duplicates of a database entity called "Post" in my program. In order to do this I want to append a number like "1" or "2" next to it. In other words: helloworld helloworld1 helloworld2 In order to do this I need to query the database for postid's starting with helloworld. I read that GQL doesn't sup...
0
0
0
0
false
23,071,550
0
117
1
0
0
23,070,947
Could you make the number a separate field? Then you won't have to search for prefix.
1
0
0
How to look for a substring GQL?
2
python,google-app-engine,webapp2,gql
0
2014-04-14T21:39:00.000
I need ID of an object which I've just added using session.add(). I need the auto-increment ID of this object before committing session. If I called the object instance.id, I get None. Is there a way to get ID of a object without committing?
9
13
1.2
0
true
23,080,688
0
6,464
1
0
0
23,076,483
Simple answer: call session.flush().
1
0
0
SQLAlchemy get added object's id without committing session
1
python,sqlalchemy
0
2014-04-15T06:51:00.000
Using postgresql9.1.9 in pylons1.0 project with mod_wsgi. Getting "out of memory error". Query is of about 1.4 million lines and it crashes on query.all(). The column used for filtering is indexed. In postgresql.conf, shared_buffers=24MB, max_connections=100. Can you please suggest the work around?
0
1
0.197375
0
false
23,084,850
0
292
1
0
0
23,077,972
Query is of about 1.4 million lines and it crashes on query.all(). When you say it crashes: Do you mean the python client executable, or the PostgreSQL server? I strongly suspect the crash is in Python. I'd say you're reading all results into memory at once, and they jus tdon't fit. What you will need to do is progres...
1
0
0
MemoryError for postgresql 9.1.9
1
python,postgresql,mod-wsgi
0
2014-04-15T08:10:00.000
I want to connect to a mySQL database with python, then query a number corresponding to an image, and load this image in Qt. From what I found online, it is suggested not to use mysql database to store the image, but instead store a file location on the server. If this is the case, can I load the image (do i have to ...
0
1
0.197375
0
false
23,191,497
0
421
1
0
0
23,190,976
You don't need to download the file using FTP (or the like) to load it into Qt. Assuming the database stores the correct file path to the image, you can just use the same functionality once you get the file path, i.e. you anyway only need the file path to load the image into Qt. There is nothing special you would do by...
1
1
0
mySQL connection and loading images to Qt
1
python,mysql,pyqt
0
2014-04-21T04:50:00.000
I searched around and couldn't really find any information on this. Basically i have a database "A" and a database "B". What i want to do is create a python script (that will likely run as a cron job) that will collect data from database "A" via sql, perform an action on it, and then input that data into database "B". ...
3
4
0.664037
0
false
23,237,519
0
156
1
0
0
23,237,444
Would a Class be better for this? Probably not. Classes are useful when you have multiple, stateful instances that have shared methods. Nothing in your problem description matches those criteria. There's nothing wrong with having a script with a handful of functions to perform simple data transfers (extract, transfor...
1
0
1
Collecting Data from Database, functions vs classes
1
python,mysql,database,class,oop
0
2014-04-23T07:17:00.000
I have made a database file using SQL commands in python. i have used quite a lot of foreign keys as well but i am not sure how to display this data onto qt with python? any ideas? i would also like the user to be able to add/edit/delete data
1
1
0.099668
0
false
23,281,662
0
4,532
1
0
0
23,268,179
This question is a bit broad, but I'll try answering it anyway. Qt does come with some models that can be connected to a database. Specifically classes like QSqlTableModel. If you connect such a model to your database and set it as the model for a QTableView it should give you most of the behavior you want. Unfortunate...
1
1
0
How to display data from a database file onto pyqt so that the user can add/delete/edit the data?
2
python,sql,qt,pyqt
0
2014-04-24T11:55:00.000
Is there a way to use pandas to_excel function to write to the desktop, no matter which user is running the script? I've found answers for VBA but nothing for python or pandas.
2
1
0.099668
1
false
23,279,735
0
781
1
0
0
23,279,546
This depends on your operating system. You're saying you'd like to save the file on the desktop of the user who is running the script right? On linux (not sure if this is true of every distribution) you could pass in "~/desktop/my_file.xls" as the path where you're saving the file
1
0
0
to_excel on desktop regardless of the user
2
python,pandas
0
2014-04-24T20:51:00.000
This is a very very strange issue. I have quite a large excel file (the contents of which I cannot discuss as it is sensitive data) that is a .xlsx and IS a valid excel file. When I download it from my email and save it on my desktop and try to open the workbook using xlrd, xlrd throws an AssertionError and does not s...
6
2
0.197375
0
false
29,564,738
0
2,289
1
0
0
23,346,771
rename or Save as your Excel file as .xls instead of .xlsx Thank You
1
0
0
xlrd cannot read xlsx file downloaded from email attachment
2
python,excel,xlrd,fileparsing
0
2014-04-28T16:50:00.000
I have installed Python version 3.4.0 and I would like to do a project with MySQL database. I downloaded and tried installing MySQLdb, but it wasn't successful for this version of Python. Any suggestions how could I fix this problem and install it properly?
53
0
0
0
false
49,185,013
0
143,430
1
0
0
23,376,103
for fedora and python3 use: dnf install mysql-connector-python3
1
0
0
Python 3.4.0 with MySQL database
11
python,mysql,python-3.x,mysql-python,python-3.4
0
2014-04-29T22:01:00.000
I'm running a python script that makes modifications in a specific database. I want to run a second script once there is a modification in my database (local server). Is there anyway to do that? Any help would be very appreciated. Thanks!
8
3
0.197375
0
false
23,382,595
0
20,648
1
0
0
23,382,499
You can use 'Stored Procedures' in your database a lot of RDBMS engines support one or multiple programming languages to do so. AFAIK postgresql support signals to call external process to. Google something like 'Stored Procedures in Python for PostgreSQL' or 'postgresql trigger call external program'
1
0
0
Run python script on Database event
3
python,mysql,database,events
0
2014-04-30T07:49:00.000
I'm trying to use the data collected by a form I to a sqlite query. In this form I've made a spin button which gets any numeric input (ie. either2,34 or 2.34) and sends it in the form of 2,34 which python sees as str. I've already tried to float() the value but it doesn't work. It seems to be a locale problem but someh...
0
1
1.2
0
true
23,389,055
0
48
1
0
0
23,388,647
AFAIK, WinXP supports setlocale just fine. If you want to do locale-aware conversions, try using locale.atof('2,34') instead of float('2,34').
1
1
0
pygtk spinbutton "greek" floating point
1
python,sqlite,pygtk
0
2014-04-30T12:53:00.000