liberapay / postgres.py

A nice PostgreSQL client library
https://postgres-py.readthedocs.org/
MIT License
62 stars 18 forks source link

conform to Records' API #55

Open chadwhitacre opened 8 years ago

chadwhitacre commented 8 years ago

@kennethreitz has launched Records, "SQL for Humans™". Given the relative star count (~1,500 in 6 days vs. 36 in 3 years), it seems that the Python world now has a de facto DB-API 3.0—and it's not ours. :o)

Records is database-agnostic (cf. https://github.com/kennethreitz/records/issues/41). So far it seems to me that there's value in continuing with Postgres.py because of the ORM layer. The proposal here is to change our top-level run/one/all API to conform to what @kennethreitz has come up with:

row_iterator = db.query('select * from foo')
row_list = row_iterator.all()

So we'd essentially rename run to query, and chain all (and one, which Records doesn't have—yet?) onto the result.

Changaco commented 8 years ago

I think both projects should add compatibility with the other, the shortcut methods of postgres.py and the chaining of Records are both useful.

chadwhitacre commented 8 years ago

(and one, which Records doesn't have—yet?)

https://github.com/kennethreitz/records/pull/43