Here are some thoughts on the next steps in PyGreSQL development.

First, even though there haven't been any real changes, we should release a 5.0.6 version that ships with binaries for Python 3.7 and the proper trove classifier for the license. The problem with 5.0.5 was that we couldn't release it on PyPI because they introduced a slightly different trove classifier that prevented uploading. And 5.0.5 was released before Python 3.7 and not yet tested with that version.

Second, we should start working on 5.1.0 in the trunk.

As a first step, I would like to include Justin's patch for query results as iterables (instead of lists) in PyGres classic.

So far we have these methods:
getresult(), dictresult() and namedresult()

We could add the following methods for getting iterables:
getiter(), dictiter() and namediter()

And we should make the iterables follow the sequence protocol.

We can then deprecate ntuples() because it would be the same as len().

Actually we could use attributes/properties instead of methods and getiter() would not be needed, as we can make the query itself iterable; it would then return tuples. dictiter() could become as_dicts, namediter() could become with_names, used like so:

for row in query:
  print row[0], row[1]

for row in query.as_dicts:
  print row['id'], row['name']

for row in query.with_names:
  print row.id, row.name

The old methods could become deprecated aliases:

query.getresult() = list(query)
query.dictresult() = list(query.as_dicts)
query.namedresult() = list(query.with_names)

What do you think?

-- Christoph
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to