bayeslite icon indicating copy to clipboard operation
bayeslite copied to clipboard

Return value of execute and sql_execute should be documented

Open jar600 opened this issue 8 years ago • 2 comments

The API documentation says execute returns a cursor, but doesn't say what a cursor is or what its methods are or give a hyperlink to outside documentation.

Similarly, for sql_execute, nothing at all is said about the return value. (I gather the result is a pandas.DataFrame, but the documentation should say so.)

This makes it hard (impossible) to figure out how to access a table from python, which would seem to be a primary use case for the API.

Some examples of doing SELECT through the API would be nice.

jar600 avatar Aug 30 '17 01:08 jar600

Date: Tue, 29 Aug 2017 18:13:42 -0700 From: Jonathan Rees probably [email protected]

The API documentation says execute returns a cursor, but doesn't say what a cursor is or what its methods are or give a hyperlink to outside documentation.

It is an instance of BayesDBCursor, which has a docstring at least, and so should turn up in the documentation. Maybe there is a missing link somewhere.

Similarly, for sql_execute, nothing at all is said about the return value. (I gather the result is a pandas.DataFrame, but the documentation should say so.)

Not a pandas dataframe; rather, an apsw cursor: https://rogerbinns.github.io/apsw/cursor.html#cursors

Some examples of doing SELECT through the API would be nice.

If you'd like to write them, you might find some inspiration in the tests.

riastradh-probcomp avatar Aug 30 '17 01:08 riastradh-probcomp

Thanks. I think I've figured out what I need to know for my own purposes. The issue is specifically about the documentation, by which I mean the 'Bayeslite API reference' currently on the web at http://probcomp.csail.mit.edu/bayesdb/doc/api.html, not a request for information for me in particular.

I don't think I'll have time to fix this, but if there's any interest in having people outside the project be able to use the API using the documentation as their guide (as opposed to reading source code), without the advantage I have of being able to ask questions of human beings, then I recommend that the documentation be improved, at least in this particular way.

jar600 avatar Aug 30 '17 02:08 jar600