Questions tagged [psycopg3]

Use this tag for questions about the psycopg3 Postgresql connector package for Python, a new implementation of the psycopg2 package.

psycopg3 is a new implementation of the Postgresql connector for Python.

External links

70 questions
0
votes
1 answer

what is the psycopg 3.0.9 equivalent of composite casters in psycopg2?

import psycopg from psycopg.types.composite import CompositeInfo, register_composite def insert_data(self): pg = psycopg.connect(self.connection_string) cursor = pg.cursor() class TradeComposite(CompositeInfo): …
ericshaaan
  • 251
  • 1
  • 3
  • 5
0
votes
0 answers

How to ensure that an empty table is populated with psycopg?

I am trying to find an efficient and reliable way to ensure that my INSERTs have indeed taken place for my empty tables. While I would like to use a function like this connection_info = "..." def insert(statement: str, validate: bool): with…
Will Be
  • 89
  • 1
  • 7
0
votes
1 answer

Psycopg3 unable to connect async

Unable to connect postgres database using async psycopg3 : import asyncio import psycopg async def main(): async with await psycopg.AsyncConnection.connect('postgresql://xxxxxxxxxxx') as con: async with con.cursor() as cur: …
D. Hard
  • 21
  • 4
0
votes
1 answer

Pymongo vs pyscopg3: orders of magnitude difference for writes?

I have an application that collects crypto prices from decentralized exchanges (nothing commercial, the goal is mainly to learn some databases techs with real data). I got it working with MongoDB and PostgresSQL. However, I'm seeing massive…
JPFrancoia
  • 4,866
  • 10
  • 43
  • 73
0
votes
0 answers

Cant find element in set (Psycopg, PostgreSQL)

This should be easy, so maybe I've fried my brain, but I can't get this to work. I have a database with over a million rows. I want to add about 15k more rows, but some of the data might already exist in the database. My basic process is this: async…
0
votes
1 answer

UTF-8 in psycopg3

I'm refactoring a python code base that is using psycopg2 to psycopg3. The code has calls to .mogrify() which is not present in psycopg3. The code has something like this ensure that the strings are in UTF-8: arg_str =…
Demeter P. Chen
  • 823
  • 1
  • 7
  • 16
0
votes
0 answers

python psycopg logic error when inserting and retrieving from db

tldr; Can someone explain how to optimally structure a psycopg INSERT statement using variables for the data being entered? I am attempting to store basic data types into a PostgreSQL database using psycopg. The first block of code is my attempt to…
Caritas
  • 45
  • 3
-1
votes
1 answer

How to create a Docker FROM fedora:37 that will connect to PostgreSQL ver 15.2?

I need to run a Docker container running python code that can make a connection to an existing PostgreSQL ver 15.2 database. I have successfully done this with FROM fedora:36 installing these packages like so RUN dnf -y upgrade --refresh \ &&…
user10664542
  • 1,106
  • 1
  • 23
  • 43
-2
votes
1 answer

Psycopg3: NaN to null conversion in COPY statements

In psycopg2 it was possible to covert NaN values to nulls, using adapters like this: __REGISTERED = False def _nan_to_null(f, _NULL=psycopg2.extensions.AsIs('NULL'), _Float=psycopg2.extensions.Float): if not np.isnan(f): …
gosuer1921
  • 101
  • 1
  • 4
-2
votes
1 answer

Getting psycopg.ProgrammingError: invalid connection option "database" when pasing database parameter

Hey I am new to Databases and I decided to use Postgresql for convinience. And I am using an adapter for the Python programming language of the database named Psycopg I followed the installation tutorial of Psycopg2 but I was getting an error so I…
Aditya Yadav
  • 607
  • 1
  • 5
  • 15
1 2 3 4
5