pygresql

pygresql - insert and return serial

I'm using PyGreSQL to access my DB. In the use-case I'm currently working on; I am trying to insert a record into a table and return the last rowid... aka the value that the DB created for my ID field: create table job_runners ( id SERIAL PRIMARY KEY, hostname varchar(100) not null, is_available boolean default...

PyGreSQL NULLs for integer field

I am trying to insert some rows into a table which has a field of integers, which can be NULL: cur.execute("INSERT INTO mytable (id, priority) VALUES (%(id)d, %(priority)d)", \ {'id': id, 'priority': priority}) The priority variable is either an integer or None. This works when priority has an integer value, however, when ...

python sql interval

With PostgreSQL, one of my tables has an 'interval' column, values of which I would like to extract as something I can manipulate (datetime.timedelta?); however I am using PyGreSQL which seems to be returning intervals as strings, which is less than helpful. Where should I be looking to either parse the interval or make PyGreSQL return ...

Why can't I import pg.py ?

import pg Traceback (most recent call last): File "", line 1, in import pg File "C:\EPD\lib\site-packages\pg.py", line 21, in from _pg import * ImportError: DLL load failed: The specified module coul...