]> git.ipfire.org Git - thirdparty/psycopg.git/commit
Move the row maker as a Transformer attribute
authorDenis Laxalde <denis.laxalde@dalibo.com>
Thu, 11 Feb 2021 11:22:32 +0000 (12:22 +0100)
committerDenis Laxalde <denis.laxalde@dalibo.com>
Thu, 11 Feb 2021 16:12:25 +0000 (17:12 +0100)
commit7e12de7cd4cb9411539240953a1b90fa284fb750
treea14fdc928fc3aa505294c4fbb5c3ee90b22c4414
parent39287db88368b3ae0370a9049781d3e8ec5d9f41
Move the row maker as a Transformer attribute

Instead of carrying the row maker (_make_row attribute) on the cursor
and possibly calling it to transform each row in cursor methods, we
define a 'make_row' attribute on Transformer that is possibly used in
load_row() and load_rows().

In the Python implementation of Transformer.load_rows(), we use tuple as
as make_row() when the attribute is unset.

In the Cython implementation, we make 'make_row' a plain property with a
'_make_row' attribute under the hood. We finally transform individual or
list of records using self.make_row().
psycopg3/psycopg3/_transform.py
psycopg3/psycopg3/cursor.py
psycopg3/psycopg3/proto.py
psycopg3_c/psycopg3_c/_psycopg3.pyi
psycopg3_c/psycopg3_c/_psycopg3/transform.pyx