Tagged Questions
0
votes
0answers
11 views
redis.exceptions.ConnectionError: Error -2 connecting to localhost:6379. Name or service not known
I have this error when I run my code in server, my env is debian, and Python2.7.3
Traceback (most recent call last):
File "fetcher.py", line 4, in <module>
import mirad.fetcher_tasks as ...
10
votes
4answers
213 views
Necessity of explicit cursor.close()
From time to time, I'm executing raw queries using connection.cursor() instead of using ORM (since it is definitely not a silver bullet).
I've noticed that in several places I don't call explicit ...
0
votes
0answers
16 views
Running most unit tests against SQLite, but switching to MySQL for tests that require it
I'm working on a Django 1.3 app. We have a pretty comprehensive test suite that takes FOREVER to run, and we're looking for ways to speed up the performance of the tests.
Most of the tests could be ...
0
votes
1answer
23 views
Does open connection block database?
I have a (Python) program that checks if a table (given by its name) exists in a (sqlite) database. If the table does not exist, the program creates the table.
My problem is parallel processes. It ...
0
votes
2answers
40 views
Python: Dealing with MySQL connect hanging
I am starting a large number of python jobs simultaneously on a cloud computing provider (about 320 jobs). Each of the python jobs makes a few connections to a MySQL server when they start. The ...
0
votes
1answer
39 views
Connect to local Oracle database from online website
I have a "local" Oracle database in my work network. I also have a website at a hosting service.
Can I connect to the 'local' Oracle database from the hosting service? Or does the Oracle database ...
0
votes
1answer
260 views
mysqldb how to connect with phpmyadmin
I have a lamp server and then I installed mySqldb for my pyhton scripts. Now I can't access to the mysql(from lamp) from python scrip, because it connecting to the mysqldb and also I can't access to ...
1
vote
1answer
41 views
python close mysql database connection
I have a python script which uses a MySQL database connection, I want the database connection to be closed when the instance of the class does no longer exist therefore in my class I implemented a ...
2
votes
1answer
50 views
What are the drawbacks and advantages to implementing namespacing with databases in Redis?
Trying to organize our Redis keyspaces in a simple and (somewhat) extensible way, we've found an interesting mechanism: databases. The idea would be to a name (say person, for example) to a database ...
0
votes
1answer
259 views
Python mysql (using pymysql) auto reconnect
I'm not sure if this is possible, but I'm looking for a way to reconnect to mysql database when the connection is lost. All the connections are held in a gevent queue but that shouldn't matter I ...
0
votes
0answers
241 views
pyodbc connection string sql server authentication
I know this question has been asked many times on the web resulting in many different solutions none which have worked for me.
For my scenario I'm attempting to do a simple connection to a MS Sql ...
0
votes
1answer
192 views
Manage database connection with Python singletons
I have created my own module to manage objects in database. In order to limit the connections to the database, I design a dedicated class in a singleton way.
The construstor is invoked as expected ...
0
votes
1answer
22 views
Getting connection object in generic model class
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 ...
0
votes
0answers
41 views
cogent.db.ensembl cookbook example returns 'ProgrammingError', new bug?
I get an error using PyCogent to query EnsEMBl's database - I suspect this is a new bug resulting from either a new update in EnsEMBL or PyCogent.
When trying to reproduce the code for the PyCogent ...
0
votes
0answers
69 views
SQLAlchemy problems when using very long connection string
I'm using a connection-string/DSN with a really long hostname. SA seems to not like it. I've sanitized the error/trace, below.
Debugging is made difficult by the fact that this error is raised within ...
1
vote
1answer
143 views
How can I connect a SQLite local database to a HTML frontend?
I've recently ported a simple database from Ms Access to SQLite, because I wanted an open source option. Now I'm facing the problem of developing a visual form for data entry in that database.
This ...
1
vote
1answer
528 views
Python Connect to Oracle DB
I currently use PYODBC to connect to MS SQL Server and MYSQL, but now need to access an Oracle database as well.
I have Oracle SQL Developer installed on my work comp (but there doesn't seem to be ...
2
votes
1answer
169 views
Python: decryption failed or bad record mac when calling from Thread
I'm getting a "decryption failed or bad record mac" error in this code-fragment:
conn = psycopg2.connect(...)
cursor = conn.cursor()
cursor.execute("SELECT id, ip FROM schema.table;")
rows = ...
0
votes
1answer
50 views
speed of databases versus data structures - which one to use for real time view of multiprocessing? [closed]
Question: Is a database fast enough to manipulate data in a loop?
I have been attempting to increase the speed of an application which will perform very large processes on data in real time. My hope ...
0
votes
2answers
86 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 ...
1
vote
2answers
99 views
Two connections/cursors in mysqldb - commands out of sync error
I'm using mysqldb in part of a script to copy information from one database to another. A snippet of the code I have is as follows:
connection1 = mysqldb.connect('localhost', 'root', 'password', ...
1
vote
0answers
91 views
Select a single active database connection when starting Plone
I have a Plone 4 site which uses an additional Postgres database via a Z Psycopg 2 Database Connection object. Since the ZODB is sometimes replicated for testing and development purposes, there are a ...
-1
votes
1answer
100 views
python SQLITE database connection wrapper
I have the following setting:
a restricted system that contains SQLite database and is able to use python.
a usual PC-system.
My aim is to write an application (preferable JAVA) for the PC-system ...
1
vote
0answers
193 views
Connect to informix with python's ibm_db
I'm pretty new to python. I'm trying to connect to an informix server using python and ibm_db.connect(). However I can't seem to succeed and the error messages don't help.
Using java and jdbc I can ...
1
vote
0answers
127 views
pymssql error 20009 while connecting to db
This is driving me crazy and I can't figure out. I installed pymssql on my Mac and was using it without any problem. And then one day it stopped working. I have no idea why. I can run the same code on ...
1
vote
1answer
77 views
what is Python 2.x database interface?
I am re-writng a perl program using python. In the perl program, it’s using perl database interface (DBI) to perform Oracle database operations. For example, DBI->connect to connect a database, and ...
0
votes
0answers
46 views
sqlalchemy cannot connect to db within a function
I am currently doing this:
def dbconnect(databaseUrl):
try:
#check database connection
engine = create_engine(databaseUrl)
#SQLAlchemy voodoo
metadata = MetaData()
...
0
votes
1answer
23 views
musqldb-python doesnt really update the original database
I used mysqldb to connect to a database in my localhost.
It works, but if I add data to a table in the database when the program is running, it shows that it has been added, but when I check the ...
2
votes
2answers
471 views
web2py webserver - Best way to keep connection to external SQL server?
I have a simple web2py server that we use to visualize data from our PostgreSQL Server. The following functions are all part of the global models in web2py.
The current solution to fetch data is very ...
1
vote
0answers
259 views
Unable to connect using pymssql with windows authentication
While trying to connect to MSSQL Server 2012 using pymssql, I get the following error.
My server name in Windows Authentication is SARATH,User Name is Sarath\SarathShanker and I did not set a ...
1
vote
0answers
90 views
ImportError: No localization support for language 'eng' in python
i am getting ImportError: No localization support for language 'eng' when using MySQL Connector Python.
My Traceback is as below.
Traceback (most recent call last):
File \"DB_Module.py\", line 151, ...
0
votes
2answers
91 views
Python-Mysql: Multiple attempts to connect - Best Practice
I have following database connection code, initially I didn't have the while loop for multiple attempts but then I thought its better that I do multiple attempts before really fail it. My question is, ...
8
votes
1answer
321 views
How to properly handle Redis connections with Python / Python RQ?
What is the best pattern to handle Redis connections (both for interacting with Redis directly and indirectly through Python-RQ)?
Generally, database connections need to be closed / returned to a ...
2
votes
0answers
645 views
Python MySQLdb connection - when to open/close new connections?
I'm using a few apps running Tornado Web server which all connect to a MySql DB using mysqldb. When I spin up the server, it instantiates a DB class (below) which opens a connection to the DB. All ...
1
vote
2answers
1k views
Update database with multiple SQL Statments
I am using mysql connector.Python 1.0.9 downloaded from MySQL site.
I have a sample table here
DROP TABLE IF EXISTS my_table;
CREATE TABLE my_table
(id INT NOT NULL AUTO_INCREMENT UNIQUE,
Shot ...
0
votes
2answers
2k views
“Can't connect to MySQL server on 'localhost' (10061)” error in python
Just today I have decided that I wanted to learn python because I personally like the syntax and its feel. I am a pretty young developer and I really wanted to learn a new programming language since I ...
1
vote
1answer
694 views
OperationalError: unable to open database file in PyCharm with Flask IDE plug-in
I have been struggling with this for the better part of the day. I am absolutely incapable of connecting to my database in PyCharm. I even follow the video tutorial exactly while downloading the ...
3
votes
1answer
803 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
...
3
votes
2answers
2k 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
309 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 ...
5
votes
1answer
349 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
249 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
377 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.
...
1
vote
3answers
4k 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
458 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 ...
6
votes
5answers
8k 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 ...
11
votes
4answers
4k 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 ...
3
votes
2answers
1k 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
592 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
400 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 ...