Last active
July 18, 2018 03:40
-
-
Save BlogBlocks/9cc44e95db00a0277b3fb03d8299466e to your computer and use it in GitHub Desktop.
View sqlite3 rows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sqlite3 | |
| """ | |
| import ViewRows | |
| database = "runit.db" | |
| Start = 10 | |
| NumToView= 15 | |
| ViewRows.viewrows(database,NumToView,Start) | |
| """ | |
| def viewrows(database,NumToView,Start): | |
| conn = sqlite3.connect(database) | |
| conn.text_factory = lambda x: unicode(x, "utf-8", "ignore") | |
| c = conn.cursor() | |
| #c.execute('INSERT INTO runit(target, targetS) VALUES(?, ?)',(target, targetS)) | |
| #rows = c.execute("SELECT rowid, target, targetS FROM runit ORDER BY rowid DESC LIMIT 5;") | |
| #SELECT rowid, * from ipynb LIMIT ? OFFSET ?', (id2, id1)): | |
| #rows = c.execute("SELECT rowid, target, targetS FROM runit ORDER BY rowid DESC LIMIT (?)",(5)): | |
| for row in c.execute('SELECT rowid, * from runit LIMIT ? OFFSET ?', (NumToView, Start)): | |
| print row[0],row[1],row[2] | |
| #c.close();conn.close() | |
| return row | |
| #UNCOMMENT BELOW: to use with default values | |
| """ | |
| if __name__ == "__main__: | |
| database = "runit.db" | |
| Start = 10 | |
| NumToView= 15 | |
| ViewRows(database,NumToView,Start) | |
| """ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment