Fix Python – How can I get dict from sqlite query?

db = sqlite.connect(“test.sqlite”)
res = db.execute(“select * from table”)

With iteration I get lists coresponding to the rows.
for row in res:
print row

I can get name of the columns
col_name_list = [tuple[0] for tuple in res.description]

But is there some function or setting to get dictionaries instead of list?
{‘col1’: ‘value’, ‘col2’: ‘….

Fix Python – How to retrieve inserted id after inserting row in SQLite using Python?

How to retrieve inserted id after inserting row in SQLite using Python? I have table like this:
id INT AUTOINCREMENT PRIMARY KEY,
username VARCHAR(50),
password VARCHAR(50)

I insert a new row with example data username=”test” and password=”test”. How do I retrieve the generated id in a transaction safe way? This is for a website solution, where t….