Questions tagged [pygresql]

PyGreSQL is the oldest open-source Python module that interfaces to a PostgreSQL database. It runs on most platforms where PostgreSQL and Python are running.

The current version PyGreSQL 5.0+ needs PostgreSQL 9.0 or newer and Python 2.6, 2.7 or 3.3+.

See the docs at http://www.pygresql.org/

48 questions
7
votes
2 answers

Installing pgdb: pg_config tool is not available

So here is my goal: To get a .py file that imports pgdb, to run. For this, as far as I have understood, I need PygreSql. I have both postgresql 9.4.4 and python 2.7.9 installed (Postgresql with source code and python with the normal download form…
Sahand
  • 7,980
  • 23
  • 69
  • 137
4
votes
1 answer

error : command 'gcc' failed with exit status 1 while installing pygresql

I am trying to install the pygresql package using "pip install pygresql" but I get the error : command 'gcc' failed with exit status 1 I've tried a lot of thing but I still do not understand why it is not working Collecting pygresql Using cached…
PaulineLqt
  • 41
  • 1
  • 1
  • 2
4
votes
3 answers

ver.2 PyGreSQL ERROR: from _pg import * ImportError: DLL load failed: The specified module could not be found

I have the same problem that was discussed here, but I haven't credit to comment an answer so I start new question. I have in PATH way to libpq.dll (C:\PostgreSql\lib) but it doesn't solve this problem. Using Python 2.7.9 32-bit, PostgreSQL 8.4,…
Vena Vena
  • 67
  • 1
  • 5
3
votes
1 answer

pygresql copy_from gives a relation does not exist error

I have the following code pg_con = conns.con_to_pg() cur = pg_con.cursor() with open('up_md.csv', 'r') as f: next(f) # Skip the header row. tbl = 'bidba.upmeta' cur.copy_from(f, tbl, 'csv', sep=',') pg_con.commit() The schema and…
dani shamir
  • 81
  • 1
  • 9
3
votes
1 answer

PyGreSQL is returning unexpected result for a one column select statement

I have the following PostgreSQL database table: TABLE session_monitor ( id int, customer_name varchar(150) ) When I am running the following code: seq = pg_cur.execute("SELECT id ,customer_name from session_monitor") for id, customer_name…
dani shamir
  • 81
  • 1
  • 9
3
votes
1 answer

Get lazy but reusable cursor with Psycopg2

I saw in the docs that you need to use server-side ("named") cursors to avoid loading all results into memory at once. But then I found that server-side cursors aren't reusable. You can only do a single .execute on them. (Otherwise you get…
BrenBarn
  • 242,874
  • 37
  • 412
  • 384
2
votes
4 answers

Using Python/PyGreSQL, how can I efficiently handle a large result set?

I have a query result set of ~ 9-million rows. I need to do some processing for each row, and the code currently does this: query = conn.query(sql) results = query.getresult() for row in results: # blah I'm not sure, but I imagine that…
anonymous coward
  • 12,594
  • 13
  • 55
  • 97
2
votes
2 answers

Execute SQL select in statement using pygresql(pg module)

I am working on a python script to connect to postgress databases using pygresql module. Below is the code I am trying to run the query by passing tuple as parameter. query looks like this: select sum(column1) from table_name where column2 in…
sudhir
  • 219
  • 5
  • 17
2
votes
1 answer

Inserting None value into Date column from python to PostgreSQL database using PygreSQL v5.0.6

I am struggling to insert None values into the date column of a PostgreSQL database from python using PygreSQL v5.0.6. Some code: def _update_traits_db(self, code, date_start, date_end, unit): sql = ("Insert into traits (code, date_start,…
Kevin
  • 21
  • 1
  • 5
2
votes
0 answers

Using PyGreSQL: 'bytes' object has no attribute 'encode'

I'm trying to import PyGreSQL in Python. I've successfully installed it with pip, and also have GLFW3 installed, but I run into the following error when I import >>> import pg Traceback (most recent call last): File "", line 1, in
Noah Walton
  • 123
  • 2
  • 8
2
votes
3 answers

Import Errror for python pg module

I am having trouble using the pg module in my code. I've installed it using pip. But when I go to run it I get the following error: Traceback (most recent call last): File "Contract_gen.py", line 2, in import pg File…
JoesLost
  • 41
  • 1
  • 5
2
votes
1 answer

clang error when installing pygresql under Mac OS

I was trying to install PyGreSQL under Mac OS X(10.11.3), but the same clang error occurs when installing from pip and source. $ python3 setup.py install running install running bdist_egg running egg_info writing PyGreSQL.egg-info/PKG-INFO writing…
Jacob Yin
  • 21
  • 3
2
votes
1 answer

Failture installing PyGreSQL with pip

I am currently trying to install PyGreSQL using pip install PyGreSQL, however, when I run the command I get the following error: Could not import setuptools which is required to install from a source distribution. Traceback (most recent call…
Cesar
  • 115
  • 3
  • 10
2
votes
2 answers

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 could…
manwithafork
  • 21
  • 1
  • 2
1
vote
2 answers

Making PyGreSQL to work in AWS Lambda (Python 3.9) to connect to a PostgreSQL instance

I struggled a bit to make PyGreSQL to work in AWS Lambda (Python 3.9) to connect to an Aurora PostgreSQL instance. Searching google and stack overflow didn't return any relevant results. Most of the hits were for making psycopg2 to work with AWS…
Arabinda
  • 11
  • 3
1
2 3 4