We’re happy to share that Daniele Varrazzo, maintainer of psycopg, will be attending @fosdempgday this Friday and @fosdem on the weekend.

If you’re around, feel free to come say hi and ask him any questions you may have about Psycopg, PostgreSQL or Python database drivers. Drop us a message here if you wish.

See you soon! 👋

Photo from PyCon Italia 2022

#FOSDEM #PostgreSQL #Python #psycopg #OpenSource #fosdempgday

[Перевод] Самый быстрый способ загрузить 32 000 строк в PostgreSQL с помощью Python

Команда Python for Devs подготовила перевод статьи о том, как найти самый быстрый способ загрузки данных в PostgreSQL с помощью Python. Автор пошагово сравнил разные методы — от построчных вставок до COPY с потоковой генерацией CSV — и показал, как ускорить процесс более чем в 250 раз при нулевом потреблении памяти.

https://habr.com/ru/articles/948854/

#postgresql #python #psycopg #загрузка_данных #импорт_данных #csv #copy #execute_batch #execute_values #оптимизация_производительности

Самый быстрый способ загрузить 32 000 строк в PostgreSQL с помощью Python

Команда Python for Devs подготовила перевод статьи о том, как найти самый быстрый способ загрузки данных в PostgreSQL с помощью Python. Автор пошагово сравнил разные методы — от построчных вставок до...

Хабр

@psycopg I am honored to have participated in the resolution of issue #999 :)

https://github.com/psycopg/psycopg/issues/999

#Django #Psycopg #PostgreSQL #Memcached #PyLibMC #Python #Cache

Hard to satisfy dependencies in Django tests · Issue #999 · psycopg/psycopg

Django main version has recently started to require Python 3.12, see this CI failure. However we had pinned the 3rd party integration test to use Python 3.11, because a dependency doesn't offer a w...

GitHub

Psycopg 3.2 has been released 🚀
https://www.psycopg.org/articles/2024/06/30/psycopg-32-released/

I can't wait to test it with Django 5.1b1 😬

#PsycoPG #Python #PostgreSQL #Postgres #Django #ORM

CC @psycopg

Psycopg 3.2 released — Psycopg

Python adapter for PostgreSQL

How does #Psycopg benefit from #PostgreSQL 17?
Read the last article of @dlax to find out => https://dali.bo/202404_psycopg3-2

#opensource #DBMS #python

Improved query cancellation in PostgreSQL 17 and Psycopg 3.2

Any #python #psycopg people know why this works

```
#results = conn.execute('SELECT (embedding <=> %s) as distance, abstract FROM documents ORDER BY embedding <=> %s LIMIT 5', (query_embedding, query_embedding, )).fetchall()
```

But this throws an error
```
results = conn.execute(f'SELECT (embedding <=> {query_embedding}) as distance, abstract FROM documents ORDER BY embedding <=> {query_embedding} LIMIT 5').fetchall()
```

error in the thread

Just hit another issue related to `ctypes.util.find_library("c")` being broken on #musl libc. The issue has been reported to #CPython mid-2014, and still hasn't been fixed (though admittedly the fix seems non-trivial). My workaround is to add an explicit fallback to `libc.so`, e.g.:

```
ctypes.util.find_library("c") or "libc.so"
```

https://github.com/python/cpython/issues/65821
https://github.com/psycopg/psycopg/pull/725
https://bugs.gentoo.org/923003

#Python #PsycoPG #CTypes #Gentoo

ctypes.util incorrectly fails for libraries without DT_SONAME · Issue #65821 · python/cpython

BPO 21622 Nosy @vadmium, @ncopa, @thomwiggers, @tianon, @jcastillo2nd PRs #10453#10455#10460#10461#10462#16940#18380 Note: these values reflect the state of the issue at the time it was migrated an...

GitHub

Dziś trafiłem na kolejny błąd, wynikający z tego, że `ctypes.util.find_library("c")` nie działa na systemach z #musl libc. Problem zgłoszono do CPythona w połowie roku 2014, i do dziś go nie poprawiono (choć przyznaję, że łatka jest ciut skomplikowana). Moje obejście tego problemu polega na wykorzystaniu `libc.so`, kiedy funkcja nic nie zwraca, np. poprzez:

```
ctypes.util.find_library("c") or "libc.so"
```

https://github.com/python/cpython/issues/65821
https://github.com/psycopg/psycopg/pull/725
https://bugs.gentoo.org/923003

#Python #PsycoPG #CTypes #CPython #Gentoo

ctypes.util incorrectly fails for libraries without DT_SONAME · Issue #65821 · python/cpython

BPO 21622 Nosy @vadmium, @ncopa, @thomwiggers, @tianon, @jcastillo2nd PRs #10453#10455#10460#10461#10462#16940#18380 Note: these values reflect the state of the issue at the time it was migrated an...

GitHub

Möp:

```sql
-- works, true
select 1 :: smallint = 1 :: bigint;
-- does not work
select 1 :: smallint <@ int8range(1,2);
-- ERROR: operator does not exist: smallint <@ int8range
```

Guess what psycopg passes in when giving it a python int param...

#postgresql #psycopg

The binary package is a practical choice for development and testing but in production it is advised to use the package built from sources. 🤭 https://pypi.org/project/psycopg2-binary/ #Python #Django #Postgresql #Psycopg

I plead guilty your honor

psycopg2-binary

psycopg2 - Python-PostgreSQL Database Adapter

PyPI