/pugsql

PugSQL is HugSQL for Python (but not yet)

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

pugsql

PugSQL is HugSQL for Python (but not yet)

Build Status Coverage Status

Usage

characters.sql

-- :name character-by-id :? :1
select * from characters
where id = :id;

example.py

import psycopg2
from psycopg2.extras import RealDictCursor
from pugsql import characters

conn = psycopg2.connect('postgres://postgres@localhost:5432/db', cursor_factory=RealDictCursor)
characters.character_by_id(conn, {'id': 1})
# {'id': 1, 'name': 'Bruno Ribeiro', 'specialty': 'Backend Developer', 'created_at': datetime.datetime(2018, 6, 7, 2, 8, 5, 449020)}

TODO

  • Everything :)