Skip to content
Advertisement

Tag: psycopg2

django.db.utils.DataError: value too long for type character varying(30). I am getting this error while migrating on heroku postgresql

The errors I am getting while migrating on PostgreSQL Heroku. Note: It is working fine on the local server. there is no column with 30 lengths even tried migrating after deleting all data and still getting the same error. This is the model of the project models.py Answer I just deleted the junk file inside the migrations>pycache

Inserting data into psql database with high performance

Assume, I have a Python program, and I have an Offer object Offer(title=’title1′, category=’cat1′, regions=[‘reg1’]). I want to add this Offer into psql db, with minimal number of queries (performance). Inserts of new regions and categories are rare (number of regions and categories is limited (and are unique), but number of offers is unlimited). Basically Regions and Categories can be

python psycopg2 select current_timestamp problem with timezone

I’m calling a simple select to obtain current timestamp with timezone with psycopg2 and it’s retrieving UTC time instead of my local time (-3). datetime.datetime(2021, 1, 13, 20, 49, 47, 931834, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)) In postgresql I’m doing: This retrieves (Argentina time -3): So this is correct, but in Python: Select method retrieves: So datetime object is comming with offset 0,

Problems instaling libpq-dev in ubuntu 20.04

I am currently trying to install libpq-dev to install psycopg2. The problem is, when I try to install it, an error occurs saying I don’t have the latest libpq5 version. However when I try to download the newer version of libpq5 the system says that I already have the latest version. An example of the error. Answer I would say

Failing to install psycopg2-binary on new docker container

I have encountered a problem while trying to run my django project on a new Docker container. It is my first time using Docker and I can’t seem to find a good way to run a django project on it. Having tried multiple tutorials, I always get the error about psycopg2 not being installed. requirements.txt: Dockerfile: While running docker-compose build,

Advertisement