Re: Opening a DB Connection

"Milo Pschigoda" <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
On 9/29/06, Rich Shepard <[email protected]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> > def create_schema(con):
> >    cur = con.cursor()
> >    cur.execute("create ...")
>
>    Also, is there a man page somewhere of the cursor methods? I see
> .fetchone()[0], but I don't understand the end part. What other methods are
> available for navigating through a set returned by a SELECT statement?
>
> Thanks,
>
> Rich

The best way I know of to check methods is the dir(object) command
from the interpreter, or "print dir(object)" in a program.  Also,
help(object) on most common modules, such as sqlite [ so, like
"help(sqlite3)"] will have man pages.

The obj.method()[0] just means that obj.method() returns an iterable,
and we only want the [0]'th one ( like "a=[1,2,3]" and then "a[0]"
would return 1).

--MPs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.