Questions tagged [psycopg2]

0 votes
2 replies
How to access psycopg2 error wrapped in sqlalchemy error
I'm uploading a pandas data frame to a table in Postgres using SQLalchemy and psycopg2. How do I access the psycopg2 error that is within the SQL...
0 votes
0 replies
How to make execute_values safe?
I'm using the following snippet to insert some values: execute_values( dest_cursor, f''' INSERT INTO {tName}({tColumns}) VALUES %s; ''',...
asked 1 month ago
1 votes
1 replies
No module named 'psycopg2._psycopg'
Im creating a lambda function to connect to an RDS Postgresql instance, using psycopg2 library. When i tried on my local desktop, it works fine,...
asked 1 month ago
0 votes
1 replies
Psycopg2 - Query last 24hrs of postgreSQL database cur.execute
I am having difficulty querying all data from a table during the last 24hrs and it is difficult to say if its a postgres error on my part of pyth...
asked 1 month ago
1 votes
1 replies
Error during backward migration of DeleteModel in Django
I have two models with one-to-one relationship in Django 1.11 with PostgreSQL. These two models are defined in models.py as follows: class Book(...
0 votes
0 replies
im having a syntax error when querying postgres db through psycopg in python
I am getting a sql query error when running the below code. for some reasons this code runs nicely on some files but gives error on few of them....
asked 1 month ago
0 votes
1 replies
Why can I use the results of a query only once?
I'm new to SQL and psycopg2. I'm playing around a bit and try to find our how to display the results of a query. I have a small script where I ma...
asked 1 month ago
0 votes
0 replies
Issue while installing psycopg2 in MacOS for Python3.7
I'm trying to install psycopg2 for Python 3.7 but I'm having a weird (and long) output issue. I've tried to follow several stackoverflow replies...
asked 1 month ago
0 votes
3 replies
Connect to Postgres database using AWS Secrets Manager
Wanted to use AWS Secrets manager to login to postgres without using username and password as a plain text. i am not sure if this is doable, plea...
2 votes
2 replies
Package installation failed - psycopg2 in OsX
I tried install the postgresSQL adapter for the Python: $ pipenv install psycopg2 And I got this error: Installing dependencies from Pipfile....
asked 1 month ago
0 votes
0 replies
Psycopg2 sending commit to the Redshift Cluster without calling the commit command. How do I test my SQL queries on Redshift?
I am trying to execute a bunch of queries on Redshift. However, before running the queries, I am trying to run the queries without the commit sta...
asked 1 month ago
0 votes
1 replies
SELECT command wont find column name with a colon
I have a python script to retrieve a value (table ID) from a PostgreSQL database. The column name contains a colon though and I believe this is s...
asked 1 month ago
-1 votes
1 replies
Selecting data using psycopg2 from a schema based table in PostgreSQL
I'm new to python and i have created a script to select the data from a schema based table in postgreSQL. But whenever i'm running the script,ge...
asked 1 month ago
0 votes
0 replies
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) when setting up my DB
I'm trying to set up a new DB by running the following python code but its showing that error in the title import os import sys from sqlalchemy...
asked 2 months ago
0 votes
1 replies
No module named psycopg2._psycopg2 on Google Cloud Functions
I have a Google Cloud Function that uses Google Cloud SQL through psycopg2. I have psycopg2 in my requirements.txt but once the service updates I...
0 votes
2 replies
Installing psycopg2 fails on MacOS with unclear error message
Trying to install psycopg2 using pip 19.1 on MacOS 10.14.4 returns the lengthy error message below. I understand there are warnings related to gc...
asked 2 months ago
1 votes
1 replies
Selecting data from schema based table in Postgresql using psycopg2
I'm a newbie in Python and would like to select some data from postgreSQL database using python psycopg2 API. The table I'm selecting is inside...
0 votes
1 replies
psycopg2: dynamic table, columns and values
I am trying t use psycopg2 to generate a dynamic INSERT INTO statement where table, columns and values are all dynamic. I've read the documentat...
asked 2 months ago
1 votes
0 replies
psycopg2.errors.DuplicateTable: relation “tablename” already exists, but it really doesn't exist
I keep getting this error psycopg2.errors.DuplicateTable: relation "customers" already exists and I know what it means. The problem is, there w...
asked 2 months ago
0 votes
0 replies
Unit testing SQL scripts from python
I have some SQL scripts from my colleagues for creating and inserting different tables in the database. I'm using python and psycopg2 for executi...
asked 2 months ago
0 votes
1 replies
Psycopg2 Python3 Inserting multiple variables as a List
We have a function def update_cfg(self, alert_name, description, owner, cfg_json, permission= '{"org_ids":[""], "dept_ids":[""]}'): try:...
asked 3 months ago
0 votes
1 replies
Redshift queries not working with psycopg2
I am creating a Python script to interact with schema permissions (and relative tables) on Redshift. As suggested in some other StackOverflow pos...
asked 3 months ago
1 votes
0 replies
How do I increment/decrement columns with Postgres + Psycopg2
I am trying to write a function which can increment/decrement a number of columns by specific values. I am thinking it would take an object like...
asked 3 months ago
0 votes
1 replies
how can I print unique code according to the loop if there is the same value?
how can I print unique code according to the loop if there is the same value? FullChar = 'CEFLMPRTVWXYK0123456789' total = 1000 count = 10 count...
asked 2 months ago
0 votes
0 replies
Postgis ST_GeomFromWKB return Invalid endian flag value encountered
I'm trying to test if a polygon is contain in an other polygon. In database, we have a field with geometrics datas called "wkb_geometry". I h...
asked 3 months ago