Questions tagged [psycopg]

Psycopg is a popular PostgreSQL adapter for the Python programming language. At its core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

59 questions
2
votes
2 answers

Why is my created postgres user being denied access to a table?

I have created a user for my Postgres database but I cannot access the data with the user that I set up. In a python shell I have run the following code: >>> import psycopg2 >>>…
Moe Jan
  • 369
  • 1
  • 4
  • 16
2
votes
2 answers

Psycopg missing module in Django

I have pip installed psycopg2, but when I try to runserver or syncdb in my Django project, it raises an error saying there is "no module named _psycopg". EDIT: the "syncdb" command now raises: django.core.exceptions.ImproperlyConfigured: ImportError…
Mathieu K.
  • 903
  • 8
  • 27
2
votes
1 answer

Python ImportError: No module named psycopg2

I'm trying to install Django with PostgreSQL on a CentOS 5.8 system. It originally had Python 2.4 and I have added the remi repository to install Python 2.6. This works well, and I appear to have both working; if I type 'python' it's the 2.4 version…
user1548054
  • 21
  • 1
  • 5
1
vote
2 answers

psycopg in wrong python - Ubuntu

I'm running Ubuntu. I installed python2.7 and the latest version of Postgresql. When I installed psycopg, the package showed up in the default Ubuntu version of python instead of the 2.7 version that I want to use. I tried to reinstall from within…
jabs
  • 1,694
  • 4
  • 19
  • 36
1
vote
1 answer

django/postgresql setup - psycopq2.OperationalError

I'm getting a 'psycopq2.OperationalError' when executing: python manage.py syncdb. The postgresql server seems to be up and running when tested with a djangostack script. Anyone run across this? Just going through the django tutorial and setting…
Igor
  • 63
  • 1
  • 1
  • 6
1
vote
0 answers

Python 3.5.x multiprocessing throwing "OSError: [Errno 12] Cannot allocate memory" on a 74% free RAM system

I wrote a Python 3.5 application that spawns several processes using multiprocessing library. It runs on Ubuntu 16.04.3 LTS on a dedicated server machine that ships with 2 x Intel Xeon E2690 v1 (8 cores each) and 96GB of RAM. This system runs a…
pietrop
  • 1,071
  • 2
  • 10
  • 27
1
vote
1 answer

Psycopg Not Showing Expected Data

When I follow the basic Psycopg example, I expect to retrieve data from psql. >>> import psycopg2 # Connect to an existing database >>> conn = psycopg2.connect("dbname=test user=postgres") # Open a cursor to perform database operations >>> cur =…
slavakurilyak
  • 101
  • 1
  • 10
1
vote
1 answer

psycopg2 OperationalError: invalid connection option

I am using records library to connect to redshift database. My db_url is something like postgresql://xxxxx.us-east-1.redshift.amazonaws.com:5439/customer?user=xxxxx&password=xxxxx I am using this piece of code to connect to db. On my local machine…
Anurag Sharma
  • 4,839
  • 13
  • 59
  • 101
1
vote
0 answers

Psycopg2 : raised unexpected: InterfaceError('only protocol 3 supported',)

I am using Django, PostgreSQL setup using Psycopg2 adapter. After I start my server, after few minutes this error is raised. I checked Django + Psycopg2: InterfaceError: only protocol 3 supported . It says that the latest version of Psycopg2 needs…
Harsh Bhikadia
  • 10,095
  • 9
  • 49
  • 70
1
vote
1 answer

psycopg2.ProgrammingError: syntax error at or near "%"

I am trying to use parameterized query with psycopg for deleting a bunch of rows. My script has the deletion statement like: cur.executemany( "WITH remove_rows as (DELETE FROM users WHERE userid = %s RETURNING *), insert_rows as (INSERT INTO…
user1917679
  • 33
  • 1
  • 5
1
vote
3 answers

What does Postgres do when BEGIN is run on a connection in autocommit mode?

I'm trying to better understand the concept of 'autocommit' when working with a Postgres (psycopg) connection. Let's say I have a fresh connection, set its isolation level to ISOLATION_LEVEL_AUTOCOMMIT, then run this SQL directly, without using the…
DNS
  • 37,249
  • 18
  • 95
  • 132
1
vote
2 answers

To insert to Pg by Psycopg

How can you fix the SQL-statement in Python? The db connection works. However, cur.execute returns none which is false. My code import os, pg, sys, re, psycopg2 try: conn = psycopg2.connect("dbname='tk' host='localhost' port='5432' user='naa'…
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
1
vote
1 answer

What is the meaning of 'key' in psycopg connection pooling?

I am going through Psycopg Connections Pooling documentation, and don't understand what is the purpose of 'key' argument in getconn and putconn?
thor
  • 2,204
  • 3
  • 20
  • 23
0
votes
1 answer

SQLAlchemy Engine Result Proxy error (Flask Python)

I'm creating a search tool, that uses psycopg, flask and SQLAlchemy to return results from a Postgres database. I'm getting the error: sqlalchemy.engine.result.ResultProxy object at.... This is happening when I am searching for the 'job number'.…
user9035021
0
votes
1 answer

Bad Request - The browser (or proxy) sent a request that this server could not understand

I'm trying to create a flask app where I have a text box on the webpage. When submit is pressed it searches what was entered into the text box in a postgres datbase table. I'm getting the following error: Bad Request The browser (or proxy) sent a…
user9035021