I cannot get my head around it. I want to insert the values of a dictionary into a sqlite databse.
url = \"https://api.flickr.com/services/rest/?method=flickr.ph
As written, your connector.execute()
statement is missing the parameters
argument.
It should be used like this:
connector.execute("insert into some_time values (?, ?)", ["question_mark_1", "question_mark_2"])
Unless you need the dictionary for later, I would actually use a list or tuple instead:
row = [
data.get('id'),
data.get('title'),
data.get('tags'),
data.get('latitude'),
data.get('longitude'),
]
Then your insert statement becomes:
connector.execute("insert into DATAGERMANY values (NULL,?,?,?,?,?)", *row)
Why these changes?
NULL
in the values (NULL, ...)
is so the auto-incrementing primary key will work*row
so the five-element row
variable will be expanded (see here for details).dict
as a variable name, since that's a built-in variable in Python.