jeudi 3 décembre 2015

Calling to a database in Python

I have a database with data sets like below how do call the remaining column data from a row I call using the first value.

For example how can I call '12345' and be returned '1a2b3c' 'Anna' '1'.

"12345" "1a2b3c"    "Anna"  "1"

"45678" "123abc"    "Cathy" "2"

"54321" "zaybxc"    "Alan"  "3"

I Googled around but couldn't find the syntax to make it work my solutions keep returning empty.

def get_account_balances(db, number):
    totals = []

    con =  sqlite3.connect(db)
    cur = con.cursor()    

    cur.execute('SELECT Savings, Chequing FROM Accounts')
    cur.fetchone()

Aucun commentaire:

Enregistrer un commentaire