MCPcopy Index your code
hub / github.com/Apress/python-for-matlab-development / query_results

Function query_results

code/IO/postgres_crud.py:64–70  ·  view source on GitHub ↗
(cursor)

Source from the content-addressed store, hash-verified

62 print(f'inserted {n_records} rows in {time.time()-T_start:.3} sec')
63
64def query_results(cursor):
65 query = "select sum(price), sum(n), pet from myvalues group by pet"
66 cursor.execute(query)
67 print(f'Result of {query}:')
68 for sum_price, sum_n, pet in cursor.fetchall():
69 print(f' {sum_price:.2f} {sum_n:6d} {pet:>7s}')
70 print('-' * 60)
71
72def rename_pets(cursor, before, after):
73 update_cmd = f"update myvalues set pet='{after}' where pet='{before}'"

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected