When I insert a new row into a table, what's the best way to get the autoincremented primary key of the row I just created? Like this:
def create_address_and_get_id(address_line_1, address_line_2, city, state_abbrev, postcode, country):
db = get_db()
db.execute(
'INSERT INTO mailing_address (address_line_1, address_line_2,'
' city, state_abbrev, postcode, country)'
' VALUES (?, ?, ?, ?, ?, ?)'
(address_line_1, address_line_2, city, state_abbrev, postcode, country)
)
db.commit()
#return ???
I've seen how to do this in other systems but not in python.