1

I made mistake.I used pandas after

j=("SELECT sth FROM table WHERE rowid = ? ", (index,))
df1 = pd.read_sql_query(j, conn)

index is a number So I have got an error

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pandas/io/sql.py", line 1401, in execute
    cur.execute(*args)
ValueError: operation parameter must be str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "dialog.py", line 142, in Ayat
    df1 = pd.read_sql_query(j, conn)
  File "/usr/lib/python3/dist-packages/pandas/io/sql.py", line 331, in read_sql_query
    parse_dates=parse_dates, chunksize=chunksize)
  File "/usr/lib/python3/dist-packages/pandas/io/sql.py", line 1436, in read_query
    cursor = self.execute(*args)
  File "/usr/lib/python3/dist-packages/pandas/io/sql.py", line 1413, in execute
    raise_with_traceback(ex)
  File "/usr/lib/python3/dist-packages/pandas/compat/__init__.py", line 340, in raise_with_traceback
    raise exc.with_traceback(traceback)
  File "/usr/lib/python3/dist-packages/pandas/io/sql.py", line 1401, in execute
    cur.execute(*args)
pandas.io.sql.DatabaseError: Execution failed on sql '<sqlite3.Cursor object at 0x7f6338146730>': operation parameter must be str

If I don't use pandas it is OK and functioning with no problem

  • 1
    Possible duplicate of [How to use ROW\_NUMBER in sqlite](https://stackoverflow.com/questions/16847574/how-to-use-row-number-in-sqlite) – sɐunıɔןɐqɐp Jul 27 '18 at 08:12
  • No thats not my answer.the rowid here is not a column and I don't want to create an extra column for rowid. – Maziar Parsijani Jul 27 '18 at 08:46
  • It is not clear what you are asking. Please [EDIT](https://stackoverflow.com/posts/51553594/edit) your question and provide your table, and what is exactly the expected desired output of the query. – sɐunıɔןɐqɐp Jul 27 '18 at 09:04

0 Answers0