Skip to content

Instantly share code, notes, and snippets.

@cabecada
Created April 29, 2024 18:26
Show Gist options
  • Save cabecada/dcf8f66fb4ae5d4f3733aafe72d44740 to your computer and use it in GitHub Desktop.
Save cabecada/dcf8f66fb4ae5d4f3733aafe72d44740 to your computer and use it in GitHub Desktop.
pqtrace
https://blog.dalibo.com/2022/09/19/psycopg-pipeline-mode.html
https://www.psycopg.org/psycopg3/docs/api/pq.html
conn.pgconn.trace(sys.stderr.fileno())
conn.pgconn.set_trace_flags(pq.Trace.SUPPRESS_TIMESTAMPS | pq.Trace.REGRESS_MODE)
conn.execute("select now()")
F 13 Parse "" "BEGIN" 0
F 14 Bind "" "" 0 0 1 0
F 6 Describe P ""
F 9 Execute "" 0
F 4 Sync
B 4 ParseComplete
B 4 BindComplete
B 4 NoData
B 10 CommandComplete "BEGIN"
B 5 ReadyForQuery T
F 17 Query "select now()"
B 28 RowDescription 1 "now" NNNN 0 NNNN 8 -1 0
B 39 DataRow 1 29 '2022-09-14 14:12:16.648035+02'
B 13 CommandComplete "SELECT 1"
B 5 ReadyForQuery T
<psycopg.Cursor [TUPLES_OK] [INTRANS] (database=postgres) at 0x7f18a18ba040>
conn.pgconn.untrace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment