Zach Schumacher

01/19/2022, 8:02 PM
hey all - wanted to share a lib (though currently still in alpha) I just released called pydapper. It is inspired by the NuGet lib dapper and its intent is to be a simple object mapper that sits on top of the dbapi 2.0 interface. Would love some feedback!
🚀 4
was inspired because i was tired of writing code that looks like the below in prefect tasks as well as other projects
from psycopg2 import connect

with connect("<postgresql://pydapper:pydapper@localhost/pydapper>") as conn:
    with conn.cursor() as cursor:
        cursor.execute("select * from task")
        headers = [i[0] for i in cursor.description]
        data = cursor.fetchall()

list_data = [dict(zip(headers, row)) for row in data]

Anna Geller

01/19/2022, 8:10 PM
thanks for sharing, it looks quite interesting!