Tagged Questions
1
vote
0answers
7 views
MongoDB Connection Management in Python
Is it better to do
from pymongo import Connection
conn = Connection()
db = conn.db_name
def contrivedExample(firstName)
global db
return db.people.find_one({'first-name': firstName})
or
...
0
votes
2answers
55 views
MySQLdb with multiple transaction per connection
Is it okay to use a single MySQLdb connection for multiple transactions without closing the connection between them? In other words, something like this:
conn = MySQLdb.connect(host="1.2.3.4", ...
0
votes
1answer
81 views
SQLAlchemy Core: Connection is closing unexpectedly
I have built little custom web framework on top of Python 3.2 using Cherrypy to built WSGI application and SQLAlchemy Core (just for connection pooling and executing text SQL statements).
Versions I ...
2
votes
1answer
61 views
how to reconnect with MS SQL after hibernation (S4) (or dropped connection)?
I'm running some hibernation tests using python + microsoft's pwrtest utility
Also I'm using sqlalchemy (orm) to work with database (ms sql server 2008 r2).
I'm connected to the remote sql server ...
0
votes
2answers
43 views
Python MySQL connection argument error
I am trying to write a simple program to connect MySQL and perform some operations
host = '10.0.106.40'
user = 'ddddd'
port = 3306
passwd = 'DDDDDD'
db = 'bbbbbbb'
''' Creates a MySQL connection and ...
1
vote
1answer
84 views
How to access a database in Django but without ORM support
I have a second database in my Django application, which is filled with static data about the equivalent of zipcodes in my country (Brazil) and the related streets, neighborhoods, cities and states.
...
0
votes
2answers
295 views
1049, “Unknown database 'database' ” django mysql can't connect
Exception Type: OperationalError at /
Exception Value: (1049, "Unknown database 'database'")
At the moment i tried this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', ...
0
votes
1answer
99 views
is it possible to share db connection pool per uwsgi worker instead of each django request?
Django has a philosophy of share by nothing, it recreates a db connetion upon each httprequest, the overhead is kinda HUGE.
Is it possible to make django share db connections in a pool, like, for ...
1
vote
5answers
1k views
What's causing 'unable to connect to data source' for pyodbc?
I'm trying to connect to an MSSQL database from python on Linux (SLES).
I have installed pyodbc and Free TDS. From the command line:
tsql -H server -p 1433 -U username -P password
Connects to the ...
2
votes
3answers
297 views
What if I don't close the database connection in Python SQLite
I am doing something like this...
conn = sqlite3.connect(db_filename)
with conn:
cur = conn.cursor()
cur.execute( ... )
with automatically commits the changes. But the docs say nothing ...
2
votes
2answers
154 views
set up a MySQLdb connection object for multiple databases
This question is likely noobish.
Instead of hardcoding the MySQLdb connection object: e.g,
db = MySQLdb.connect('localhost','name','pwrd','db_name')
How do I set it up so I can specify the db_name ...
0
votes
1answer
224 views
Database connection management when using only Django ORM
I am using Django ORM layer outside of Django. The project is a web application using a cusotm in-house built framework.
Now, I had no problems to set up Django ORM to run standalone, but I am a ...
0
votes
1answer
248 views
Multiple Connection on mongoengine.. Give me some examples~
I'm using mongoengine with django.
in my project web application, I need to connect at least two servers: one that is local for session, another connecting to mongolab (mongodb hosting service ...
0
votes
3answers
144 views
Automate Opening and Closing the Database Connection
I am writing a class for database queries with SQLite3 in my application. Most of the methods of the class are very similar to this:
def getPrice(self, symbol, date):
date = ...
4
votes
2answers
336 views
How to use a different database per “application instance” in Django?
The scenario
We have two applications.
TheApp
TheApp is an incredible app which customers love. Each customer gets his own
instance of the application, which means each customer will use a ...