Skip to content

Instantly share code, notes, and snippets.

@c0ldlimit
Last active December 14, 2015 04:28
Show Gist options
  • Select an option

  • Save c0ldlimit/5028008 to your computer and use it in GitHub Desktop.

Select an option

Save c0ldlimit/5028008 to your computer and use it in GitHub Desktop.
#sqlite3 #python Parameterized queries
# http://zetcode.com/db/sqlitepythontutorial/
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
uId = 1
uPrice = 62300
con = lite.connect('test.db')
with con:
cur = con.cursor()
cur.execute("UPDATE Cars SET Price=? WHERE Id=?", (uPrice, uId))
con.commit()
print "Number of rows updated: %d" % cur.rowcount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment