MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / query_with_conn

Function query_with_conn

test/cloudtest/test_managed_cluster.py:293–306  ·  view source on GitHub ↗

Execute a SQL query against the service and return results.

(
        sql: str, conn: Connection, ignore_pg_exception=False
    )

Source from the content-addressed store, hash-verified

291 conn.autocommit = True
292
293 def query_with_conn(
294 sql: str, conn: Connection, ignore_pg_exception=False
295 ) -> list[list[Any]]:
296 """Execute a SQL query against the service and return results."""
297 try:
298 with conn.cursor() as cursor:
299 LOGGER.info(f"> {sql}")
300 cursor.execute(sql)
301 return cursor.fetchall()
302 except DatabaseError:
303 if ignore_pg_exception:
304 return []
305 else:
306 raise
307
308 pid = query_with_conn("select pg_backend_pid();", conn)[0][0]
309 thread = Thread(

Callers 1

Calls 2

cursorMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected