I'm running Mac OSX. Until today I had Python 2.6 with psycopg2 running just fine, I was using it with Django and Pylons. I've just reintalled postgres (I don't know if this is connected) and suddenly I can't import psycopg2 into Python without a strange error:
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", li...
I use psycopg2 for accessing my postgres database in python. My function should create a new database, the code looks like this:
def createDB(host, username, dbname):
adminuser = settings.DB_ADMIN_USER
adminpass = settings.DB_ADMIN_PASS
try:
conn=psycopg2.connect(user=adminuser, password=adminpass, host=host)
cur = conn.c...
This has been driving me crazy for 2 days.
I have been trying to install psycopg2 using easy_install and no matter what I try (i.e using gcc-4.0 instead of the snow leopard default one) I always get the same error:
error: Setup script exited with error: command '/usr/bin/gcc-4.0' failed with exit status 1
Please see: http://dpaste.com...
Hi guys,
I have this error when i perform the following task,
results = db1.executeSelectCommand(siteSql, (),)
TypeError: unbound method executeSelectCommand() must be called with dbConnn instance as first argument (got str instance instead)
My code is as follows:
class dbConnn:
db_con = None
execfile("/Users/usera/Do...
Hi,
Consider the following code in Python, using psycopg2 cursor object (Some column names were changed or omitted for clarity):
filename='data.csv'
file_columns=('id', 'node_id', 'segment_id', 'elevated',
'approximation', 'the_geom', 'azimuth')
self._cur.copy_from(file=open(filename),
table=self.new_...
I am trying to get a fast i.e. fast and not a lot of code, way to get csv data into postgres data base. I am reading into python using csvDictreader which works fine. Then I need to generate code somehow that takes the dicts and puts it into a table. I want to do this automaticaly as my tables often have hundreds of variables. (I don't w...
Hello Guys,
With psycopg2, i get result of query in this form :
[(15002325, 24, 20, 1393, -67333094L,
38, 4, 493.48763257822799,
493.63348372593703), (15002339, 76, 20, 1393, -67333094L, 91, 3,
499.95845909922201, 499.970048093743), (15002431, 24, 20, 1394, -67333094L,
38, 4, 493.493464900383,
493.63348372593703), (150024...
Hello,
I'm trying to install a shopping cart plugin for django but having a problem when I run manage.py syncdb.
When run, it installs 4 tables, then I'm getting the following error message:
File
"(mypath)/django/db/backends/postgresql_psycopg2/base.py",
line 44, in execute
return self.cursor.execute(query, args) django....
Actually i'm using R + python with RPY2 to manipulate data and ggplot to create beautiful graphics.. i have some data in postgresql database, and i'm using psycopg2 to querying data.
I'm starting thesis, and in the future i need OLAP cube to store my (very big) simulation data : multiple dimension, aggregation query, etc.
Is there any ...
I'm passing some values into a postgres character field using psycopg2 in Python. Some of the string values contain periods, slashes, quotes etc.
With MySQL I'd just escape the string with
MySQLdb.escape_string(my_string)
Is there an equivalent for psycopg2?
...
I had problems installing psycopg2 in a virtualenv.
I tried different things explained there: http://www.saltycrane.com/blog/2009/07/using-psycopg2-virtualenv-ubuntu-jaunty/
The last thing I tried is this...
I created a virtualenv with -p python2.5 --no-site-packages
I installed libpq-dev: apt-get install libpq-dev
In the virtualenv...
Well, the question pretty much summarises it. My db activity is very update intensive, and I want to programmatically issue a Vacuum Analyze. However I get an error that says that the query cannot be executed within a transaction. Is there some other way to do it?
...
Currently I am attempting to search a database to grab certain events. My query is as such
SELECT * FROM events WHERE summary ILIKE E'%test%' AND start_time > '2010-10-01'
Simply put I need the query to look through a database of calendar events and return anything with a summary with 'test' in it and after the beginning of this month...