Most of my experience with Django thus far has been with MySQL and mysqldb. For a new app I'm writing, I'm dipping my toe in the PostgreSQL water, now that I have seen the light.
While writing a data import script, I stumbled upon an issue with the default autocommit behavior. I would guess there are other "gotchas" that might crop up...
I have this pl/pgsql function:
CREATE OR REPLACE FUNCTION get_result(id integer) RETURNS SETOF my_table AS $
DECLARE
result_set my_table%ROWTYPE;
BEGIN
IF id=0 THEN
SELECT INTO result_set my_table_id, my_table_value FROM my_table;
ELSE
SELECT INTO result_set my_table_id, my_table_v...
I have a question similar to http://stackoverflow.com/questions/1306367/python-importerror-dll-load-failed-when-trying-to-import-psycopg2-library
I'm trying to run psycopg2 with Python 2.6.5, built with Visual Studio 2008 (vc9). I get this error:
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load fail...
Last night I upgraded my machine to Ubuntu 10.04 from 9.10.
It seems to have cluttered my python module. Whenever I run python manage.py I get this error:
ImportError: No module named postgresql_psycopg2.base
Can any one throw any light on this?
...
I'm following these instructions in order to set up Django on Windows. I have installed Python 2.6, PostgreSQL 8.4, Psycopg 2.0.14 for Python 2.6 and the latest version of Django from SVN.
I'm now following these instructions to run a test project (copied from the page linked to above):
C:\Documents and Settings\John>cd C:\
C:\>mkdir d...
I'm trying to bind a float to a postgresql double precision using psycopg2.
ele = 1.0/3.0
dic = {'name': 'test', 'ele': ele}
sql = '''insert into waypoints (name, elevation) values (%(name)s, %(ele)s)'''
cur = db.cursor()
cur.execute(sql, dic)
db.commit()
sql = """select elevation from waypoints where name = 'test'"""
cur.execute(sql_...
I am trying to install postgrepsql to cygwin on a windows 7 machine and want it to work with django.
After built and installed postgrepsql in cygwin, I built and installed psycopg2 in cygwin as well and got no error, but when use it in python with cygwin, I got the "no such process" error:
import psycopg2
Tracebac...
I want to turn on logging of all SQL statements that modify the database. I could get that on my own machine by setting the log_statement flag in the configuration file, but it needs to be enabled on the user's machine. How do you enable it from program code? (I'm using Python with psycopg2 if it matters.)
...
I believe it's because I installed python using SciPy, so apparently it's not in the registry where the psycopg2 installer is looking. Anyway to fix this without installing python26 over the existing install? I'm not sure if that will corrupt it.
EDIT: My PYTHONPATH looks like the following:
'C:\\Python26\\scripts',
'C:\\Python26\\lib\...
Hello. I'm a newbie in Python and psycopg2 and have problems with a simple insert.
This is my table:
CREATE TABLE tabla
(
codigo integer NOT NULL DEFAULT nextval('dato_codigo_seq'::regclass),
informacion character(30) NOT NULL,
CONSTRAINT dato_pkey PRIMARY KEY (codigo)
)
The field codigo is a serial.
When I do the sentence:
cursor....
I got a lot of "DatabaseError: current transaction is aborted, commands ignored until end of transaction block" errors after changed from python-psycopg to python-psycopg2 as Django project's database engine.
The code remains the same, just dont know where those errors are from.
...
ORIGINAL MESSAGE (now outdated):
After running python setup.py install I get the following:
Warning: Unable to find 'pg_config' filebuilding 'psycopg2._psycopg' extension
gcc-4.0 -arch ppc -arch i386 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 - DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.2.1 (dt dec ext pq3)" -D...
I installed psycopg2 in virtualenv using easy_install psycopg2. I did not see any errors and looks like installation went fine.. there is an egg file created in the site-packages dir for psycopg2..
but when I run import psycopg2 in the interpreter, I am getting following error.. any clue? How can I fix it.. any other way to install psyc...
I'm desperately trying to successfully install psycopg2 but keep running into errors. The latest one seems to involve it not being to find "stdarg.h" (see code below). However I can see with my own eyes that a file called stdarg.h exists at /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h (where it claims it can't find anything) so I...
Hi,
I'm having strange error with installing fixture from dumped data. I am using psycopg2, and django1.1.1
silver:probsbox oleg$ python manage.py loaddata /Users/oleg/probs.json
Installing json fixture '/Users/oleg/probs' from '/Users/oleg/probs'.
Problem installing fixture '/Users/oleg/probs.json': Traceback (most recent call last):...
Hi guys,
I have a question regarding postgresql sequences.
For instance, for bigserial datatype, is it true that the sequence is advanced, then the number is retrieved and even if the insertion/committing is not successful, the sequence doesn't backtracks. Which means the next time I might be doing insertion to the table, that might be...
I'm running a bunch of queries using Python and psycopg2. I create one large temporary table w/ about 2 million rows, then I get 1000 rows at a time from it by using cur.fetchmany(1000) and run more extensive queries involving those rows. The extensive queries are self-sufficient, though - once they are done, I don't need their results a...
Sorry this is a very newbie question. When I'm trying to pass a tuple into an insert statement the quotations seem to disappear.
line=[0, 1, 3000248, 'G', 'T', 102, 102, 60, 25]
SNPinfo = tuple(line)
curs.execute("""INSERT INTO akr (code, chrID, chrLOC, refBase, conBase, \
consqual, SNPqual, maxMapqual, numbReadBases) \
VALUES (%s,%...
I got some SQL function
CREATE OR REPLACE FUNCTION tools.update_company(IN company_id integer, OUT value integer)
RETURNS integer AS
$BODY$
BEGIN
select * into value from function_making_int(company_id)
END;$BODY$
and from Psycopg2 (its inside Django if that matters) I do
c = connection.cursor()
c.callproc('tools.update_compa...
Hi,
how do i escape special characters for to_tsquery in psycopg2 python?
...