psycopg2 - Inserting list of dictionaries into PosgreSQL database. Too many executions?

Use execute_values() to insert hundreds of rows in a single query.

import psycopg2
from psycopg2.extras import execute_values

# ...

projects = [
{'name': 'project alpha', 'code': 12, 'active': True},
{'name': 'project beta', 'code': 25, 'active': True},
{'name': 'project charlie', 'code': 46, 'active': False}
]

columns = projects[0].keys()
query = "INSERT INTO projects ({}) VALUES %s".format(','.join(columns))

# convert projects values to sequence of seqeences
values = [[value for value in project.values()] for project in projects]

execute_values(cursor, query, values)
conn.commit()