SQLite Forum

sqlite bindings error
Login
That is only one value that is a text string that contains an embedded ",".  

What you think are "multiple rows" are really just "\\n" separated text.

The content of *btc_price_rows* is not rows of fields.  It is one big text field that you need to parse into a list of tuples.  .executemany requires a sequence of sequences/dictionaries as the second parameter.  That is, each member of the outer sequence is used as the binding for the statement.  That is:

```
c.executemany(SQL, bindings)
```

is semantically equivalent to

```
for onebinding in bindings:
    c.execute(SQL, onebinding)
```

without the overhead of re-preparing the SQL for each iteration.

You probably want something like this:

```
btc_price_rows = []
for line in requests.get(url, params=data).text:
  btc_price_rows.append(tuple(line.strip('\r\n').split(',')))
c.executemany("INSERT OR REPLACE INTO btc_price_table VALUES (?, ?)", btc_price_rows)
```