self.cursor._results = [res]
-class QueuedLibpqDriver(LibpqWriter):
+class QueuedLibpqWriter(LibpqWriter):
"""
A writer using a buffer to queue data to write to a Postgres database.
from psycopg import sql
from psycopg import errors as e
from psycopg.pq import Format
-from psycopg.copy import Copy, LibpqWriter, QueuedLibpqDriver, FileWriter
+from psycopg.copy import Copy, LibpqWriter, QueuedLibpqWriter, FileWriter
from psycopg.adapt import PyFormat
from psycopg.types import TypeInfo
from psycopg.types.hstore import register_hstore
cur = conn.cursor()
ensure_table(cur, sample_tabledef)
with cur.copy(
- f"copy copy_in from stdin (format {format.name})", writer=QueuedLibpqDriver(cur)
+ f"copy copy_in from stdin (format {format.name})", writer=QueuedLibpqWriter(cur)
) as copy:
assert not copy.writer._worker
copy.write(globals()[buffer])
cur = conn.cursor()
cur.execute("create temp table wat (a text, b text)")
with pytest.raises(ZeroDivisionError):
- with cur.copy("copy wat from stdin", writer=QueuedLibpqDriver(cur)) as copy:
+ with cur.copy("copy wat from stdin", writer=QueuedLibpqWriter(cur)) as copy:
copy.write("a,b")