Hi,
Newbie here so please be gentle.

Just started and created data base, actually a big one with 10+tables and 100GB 
of data.  Basically patent database.  All works and DB Browser for SQLite works 
without issue.

Testing within Python using Jupyter from Anaconda using Python 3.7.3


Code thus far
import sqlite3
db= sqlite3.connect('/Volumes/Patents/sqlitetest/test.db’)
cursor = db.cursor()
cursor.execute('''Select * FROM wipo_field'’')
for row in cursor:
    print(row[0],row[1])

1 Electrical engineering
10 Instruments
11 Instruments
12 Instruments
13 Instruments
14 Chemistry
15 Chemistry
16 Chemistry
17 Chemistry
18 Chemistry
19 Chemistry
2 Electrical engineering
20 Chemistry

Good so far.  Now here is the issue I now issue this command just for testing 
and learning purposes. Note the only difference is that I am asking for one 
column instead of two.
for row in cursor:
    print(row[1])

I get nothing. No response/output.

If I now execute this again
cursor.execute('''Select * FROM wipo_field'’')
and follow with
for row in cursor:
    print(row[1])

I get this as expected

Electrical engineering
Instruments
Instruments
Instruments
Instruments
Chemistry
Chemistry
Chemistry
Chemistry
Chemistry
Chemistry

But if I now follow that command with this

for row in cursor:
    print(row[0],row[1])

I again get no response/output.

So is the cursor a 1 use only object?  Does it null itself out after the first 
reading?

Regards,

Andy Hegedus
Founder
AGH Analytics, LLC

An Engineering Services Firm

Learn Fast











_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to