Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jdZXP-0001vD-Oa for psycopg@arkaria.postgresql.org; Tue, 26 May 2020 13:22:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jdZXO-0006Rt-Mx for psycopg@arkaria.postgresql.org; Tue, 26 May 2020 13:22:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jdZXO-0006Rl-FJ for psycopg@lists.postgresql.org; Tue, 26 May 2020 13:22:34 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jdZXM-0003Yy-7F for psycopg@postgresql.org; Tue, 26 May 2020 13:22:33 +0000 Received: by mail-lj1-x233.google.com with SMTP id l15so24105472lje.9 for ; Tue, 26 May 2020 06:22:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=wzneC6l+Fbc/LVxxKkKPBHkOGbow9dA++CHXBlBAsVQ=; b=BP3gW/X6kgCkMrzrhvAUKDFfaQb4/JjsPdV5RzDM5+FcuI73jC47csYoa8bPn6KLjb Ic0mII/TW4VIMtdq/Id4/pz0IfrwpmHuhZuQsiPaodTJpqcFhvNQJzYbMZAh0XMoyLwY M7xAza+bXLtkDGYiSer/7Z4BkZupZ0XelD7rqfdUvnlbleMVRJ0YNucbsbuwp/VVXEQB /zGZjPB2NcdTU6a7AXezigrS4iy3ApTYE0988wIUCwZaprKS6QAdG3VUxPkn5Ehw65dw 6XuCnf8ZYNWoJ24Bjsn4h6QWyCwMpy9mFf9XBLKU+/wnGBRk8LyUFJFNOG4zb6aD7fO2 Bgvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wzneC6l+Fbc/LVxxKkKPBHkOGbow9dA++CHXBlBAsVQ=; b=dj/Mt0B9Y27nOKxFlWT/TJYlIRAG9Hl0E9QsiFZVp1FDD5DvPKJ9sps/h6IiSW1ofE 78xBKcOEfsG0CXLAzDsTPij6u4uMC3GzHAugstyk12sN9Lw6S9nJAcdvISDctlT7C4GA bpRKtpBn1ePUXix3050onq/mv4A9+a4la3t7aZ10US1quP/dskQGZ1zmxeUBjWcPl10h pQvuUuf8HzSSO0XpTPHrCtJgtpxmgdV1V1Rg9ZcBFKkuxVK2QcuafsBEas710T512p59 Z0y9+LG/SjxGLZJvsVqGz4rBnT9sexd/7eIXZWcJ+xDij6dRVFAhTeOh7iSZdLovIYul enBg== X-Gm-Message-State: AOAM531KpMerZhcUU3xDczobrs2saDFeBuY0heUJH9/n2nEh7Fa9a4jY fJLPwXHzA1DH/AimeHBhIbi/8jkCzWpNTfnj8Wq0HSMKcMVhwA== X-Google-Smtp-Source: ABdhPJzWUlfHhjl5eo3x7jXQgRMzHhUoD6lyFLP8sB0eyQFDEmsvfjbbRCisj71fb23U4CBQn7m2xM+IeBlvGdD7R2o= X-Received: by 2002:a05:651c:39d:: with SMTP id e29mr584105ljp.463.1590499348598; Tue, 26 May 2020 06:22:28 -0700 (PDT) MIME-Version: 1.0 From: Daniele Varrazzo Date: Wed, 27 May 2020 01:22:15 +1200 Message-ID: Subject: Async notifications in psycopg3 To: psycopg@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, I have introduced async notifications handling for psycopg3. At the moment it comes in the form of a generator (eventually async - in asyncio sense) so that they can be used as simply as: for notify in conn.notifies(): # ... process but notifies may be also received during the normal query processing, for which a possible way to receive them can is a callback. I am not entirely convinced about the design so I'd be happy to receive some feedback by anyone who has ideas about how they would use the features. There is a more complete description and references in : happy to have a conversation either here or on the github ticket. Cheers, -- Daniele