Created
March 18, 2012 21:46
-
-
Save mehdimehdi/2082090 to your computer and use it in GitHub Desktop.
appending data to table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import connections, transaction | |
cursor = connections['noudata'].cursor() | |
# Data modifying operation - commit required | |
cursor.execute("insert into activity (user_id,name,remote_addr,referrer,hostname,points,date_created,_id,publisher_id) select user_id,name,remote_addr,referrer,hostname,points,date_created,_id,publisher_id from bson('s3://punchtab-mongolab-backups/%s');" % file_name) | |
transaction.commit_unless_managed() #I also tried without the commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment