Answers for "sql fetchone python"

SQL
1

fetchone python sqlite

#Fetches the next row of a query result set, returning a single sequence, or None when no more data is available.
import sqlite3

con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.executescript("""
    create table samples(
        id,
        value
    );
    insert into samples(id, value)
    values (
        '123',
        'abcdef'
    );
    """)
cur.execute("SELECT * from samples")
print cur.fetchone()
OUTPUT
(u'123', u'abcdef')
Posted by: Guest on July-25-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language