psycopg2 Questions

4

Solved

I want to konw, what is a proper way to closing connection with Postgres database using with statement and psyopcg2. import pandas as pd import psycopg2 def create_df_from_postgres(params: dict, ...
Antisepsis asked 25/3, 2019 at 9:26

15

Solved

Is it possible to install psycopg2 into a virtualenv when PostgreSQL isn't installed on my development system—MacBook Pro with OS X 10.6? When I run pip install psycopg2 from within my virtualenv,...
Olinger asked 12/4, 2011 at 1:19

5

Solved

I am using psycopg2 to insert command to postgres database and when there is a confilict i just want to update the other column values. Here is the query: insert_sql = ''' INSERT INTO tablename...
Chiropractic asked 25/3, 2020 at 9:10

5

Solved

Let's say if I execute the following command. insert into hello (username) values ('me') and I ran like cursor.fetchall() I get the following error psycopg2.ProgrammingError: no results to f...
Encephalogram asked 29/7, 2016 at 11:21

4

Solved

I have this code segment in Python2: def super_cool_method(): con = psycopg2.connect(**connection_stuff) cur = con.cursor(cursor_factory=DictCursor) cur.execute("Super duper SQL query") rows =...
Addition asked 2/2, 2016 at 0:34

4

Solved

To give as much context as I can / is needed, I'm trying to pull some data stored on a remote postgres server (heroku) into a pandas DataFrame, using psycopg2 to connect. I'm interested in two sp...
Naphthol asked 2/9, 2014 at 23:17

8

Solved

I'm compiling psycopg2 and get the following error: Python.h: No such file or directory How to compile it, Ubuntu12 x64.
Allaround asked 7/11, 2013 at 18:36

1

Solved

I have a function which returns a psycopg2 connection, if a connection can be established. So the return type should be Optional[psycopg2.connection], or psycopg2.connection | None. However I am un...
Ratiocinate asked 22/11, 2022 at 14:31

3

Solved

I want to create Postgres database using Python. con = psql.connect(dbname='postgres', user=self.user_name, host='', password=self.password) cur = con.cursor() cur.execute("CREATE DATABASE %s ;...
Hewett asked 27/12, 2015 at 19:34

3

I am trying to get the latest version of psycopg2 on my aws instance. I noticed that the latest version was 2.4.6 but I could only get 2.0.14 on aws. Is there a way to get the latest version? There...
Wellfavored asked 17/12, 2013 at 23:28

1

I'm trying to setup Postgres as backend database for my Airflow installation. I followed what the documentation suggests. Particularly, I created a specific user for Airflow in Postgres, a specific...
Castor asked 10/11, 2022 at 14:28

9

Solved

I'm trying to figure out how to set the connection timeout in create_engine(), so far I've tried: create_engine(url, timeout=10) TypeError: Invalid argument(s) 'timeout' sent to create_engine(...
Photocell asked 25/2, 2016 at 23:49

7

I have the following postgresql rows as JSONB row: {age:26} And I would like to replace it so that that i looks like this: {age: 30, city: "new york city"} How can I do this in postgressql? S...
Charkha asked 31/10, 2016 at 17:43

8

Solved

I am using SQLAlchemy without the ORM, i.e. using hand-crafted SQL statements to directly interact with the backend database. I am using PG as my backend database (psycopg2 as DB driver) in this in...
Lucubration asked 21/12, 2011 at 12:14

12

Solved

When I try to import psycopg2 it show below log for me: Traceback (most recent call last): File "D:/Desktop/learn/python/webcatch/appserver/testpgsql.py", line 2, in <module> import psyco...
Poser asked 19/3, 2016 at 14:38

3

Solved

What is the correct way to get the number or rows returned by this query? I'm specifically looking to see if no results are returned. sql = 'SELECT count(*) from table WHERE guid = %s;' data=[guid]...
Shirashirah asked 4/10, 2013 at 22:29

2

Solved

seeing this on Ubuntu 22.04 which has python 3.10 pip3 install psycopg2-binary==2.8.5 Defaulting to user installation because normal site-packages is not writeable Collecting psycopg2-binar...
Prospero asked 19/9, 2022 at 11:49

3

I have the below code which queries a database of about 500k rows. and it throws a SIGKILL when it hits rows = cur.fetchall(). I've tried to iterate through the cursor rather than load it all up in...
Elonore asked 2/9, 2020 at 20:38

2

Solved

Has anyone gotten this error when importing psycopg2 after successful installation? ImportError: dlopen(/Users/chrishicks/Desktop/test/venv/lib/python3.9/site-packages/psycopg2/_psycopg.cpython-39-...
Exercise asked 23/3, 2022 at 1:38

2

Solved

after long hours of trying: i installed psycopg2==2.9.1 with pip installed with pip I tried adding it to all the interpreter paths i could find but still keep getting this message: error message I ...
Helpmate asked 4/12, 2021 at 21:18

4

I have following query cur.execute("SELECT COUNT(addr) FROM list_table WHERE addr = '192.168.1.1'") to count the number of times the same address (192.168.1.1) appears on list_table table. ad...
Purchasable asked 17/12, 2014 at 18:57

9

I'm using MAC and python version 2.7.14 Collecting psycopg2 Could not fetch URL https://pypi.python.org/simple/psycopg2/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PRO...
Yoshi asked 13/4, 2018 at 7:54

5

Solved

This is my python code and I want to connect my Amazon Redshift database to Python, but it is showing error in host. Can anyone tell me the correct syntax? Am I passing all the parameters correctl...
Picaresque asked 20/7, 2017 at 10:34

3

Ive recently bought a MacBook Pro and was setting it up for some python and Django programming but I ended up having problems installing psycopg2, I've tried several things already and none of thos...
Genocide asked 26/3, 2022 at 19:41

8

I am trying to deploy a python lambda function using serverless. I need the psycopg2 library so I used the serverless-python-requirements plugin and added it to my serverless.yml file. plugins: ...
Dunker asked 30/11, 2018 at 3:40

© 2022 - 2024 — McMap. All rights reserved.