Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vKgak-004ml7-0z for psycopg@arkaria.postgresql.org; Sun, 16 Nov 2025 17:31:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vKgah-00B4y3-1k for psycopg@arkaria.postgresql.org; Sun, 16 Nov 2025 17:31:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vKgah-00B4xv-16 for psycopg@lists.postgresql.org; Sun, 16 Nov 2025 17:31:07 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vKgab-007R3c-22 for psycopg@lists.postgresql.org; Sun, 16 Nov 2025 17:31:06 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 5870B7A0187; Sun, 16 Nov 2025 12:31:00 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Sun, 16 Nov 2025 12:31:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1763314260; x=1763400660; bh=Bb2YuaeAoCcObnhcDEx8WqWBYvyB3pfjDxA2OUK6O3g=; b= HJ9DuDAsv25xYvdVBbtGwxH5KzQWlB+jNUa/AK7Slgy5LdEnWFDs8N43mF5hd+Ba o3Lpmu28kfNajz/ecz+4RWBaziJtZHPvSbeCsQlFt+LicObaY1Ey3QT8PHcSFJHp /ZbhsGQh1qwBadNaJ0VDgJDgp291IhVIdBjT9RMeRhK+h4jgqklqjYOHVtLcjKf0 oxSBPuYK3rkycGzaotH0Oq3Kup/QpDdZFt+YgiggJHzT6bA/pfgZlpuZ2McDGLNZ yxnwU+Zwlb8el0RiPrBlwBv/OzKmt3uDkwUegC7lTmxupZ8eAQu/NGfEAnDlv6nl vLa+NEWojg9Wo5DzUFdalQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1763314260; x=1763400660; bh=B b2YuaeAoCcObnhcDEx8WqWBYvyB3pfjDxA2OUK6O3g=; b=2L8otEnjxNaQlT2C1 pNdhXcPxDNGZnZkhhc1bAx4Mdl+oIPBSkwMLdD3Phw0em9nFGah2+A9WgqFdVJDn m2j9Qpg5IXKjLDOug7TJuY8wpkTqYd9QvglPWCO+YuGQTVd9n9cgH+BFlNDwQQtP XX4+O011HZvEJgoeHDlAidZBMEyCmXXa4q3RcdFugs0mWEEE3SgFeHuFHtclagHX wzhDerXc0fMR43GgmJWT5b3Zz7sS2c8sbYkiLVbqpLX+kWJrT+WlrNB6o/PvrsTX oJ23pBVeh6GUufbIiIFmUKn3iKsF8g3rHsoLXxyR5eDMviCktQLU0KuQT3UoRfMf 5aBkQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvudeiudelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertd dtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepleetgeffhefhtd evleeklefftdfgjeelieetudfhhefhteetteetteelgfdtvefhnecuffhomhgrihhnpehp shihtghophhgrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnhgs pghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepgihofhesth hhvggsuhhilhgurdgtohhmpdhrtghpthhtohepphhshigtohhpgheslhhishhtshdrphho shhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 16 Nov 2025 12:30:59 -0500 (EST) Message-ID: Date: Sun, 16 Nov 2025 09:30:59 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Overriding default adapters in psycopg To: Christophe Pettus , psycopg@lists.postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/16/25 08:56, Christophe Pettus wrote: > Hi! > > I am attempting to override the default adapters for JSON and JSONB in psycopg (3), but I am not quite sure how to go about it (I'm testing using orjson for serialization and deserialization). This doesn't appear to work: > >> class CyanJSONBDumper(Dumper): >> def dump(self, obj): >> return orjson.dumps(obj) >> >> psycopg.adapters.register_dumper("jsonb", CyanJSONBDumper) Following: https://www.psycopg.org/psycopg3/docs/api/abc.html#psycopg.abc.Dumper.dump I believe it should be something like: psycopg.adapters.register_dumper(, CyanJSONBDumper) -- Adrian Klaver adrian.klaver@aklaver.com