SQLite: Difference between revisions

Jump to navigation Jump to search
Line 15: Line 15:
===Python===
===Python===


For Python we can use the module <tt>sqlite3</tt>, installed in a virtual environment, to access an SQLite database:
{{File
  |name=sqlite.py
  |lang="python"
  |contents=
#!/usr/bin/env python3
import sqlite3
dbase = sqlite3.connect("foo.sqlite")
crs = dbase.cursor()
params = ("employees",)
crs.execute("SELECT * FROM ?;",params)
rows = crs.fetchall()
for r in rows:
    print(r)
dbase.close()
}}
===R===
===R===


Bureaucrats, cc_docs_admin, cc_staff
2,318

edits

Navigation menu