Python Forum
Unable to Update SQLite Table
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to Update SQLite Table
#1
Hi:

I am not able to get the update statement to work :( - any help on what I'm missing ?

c.execute("select DISTINCT Symbol from StockData")
tickers = c.fetchall()   
for row in tickers:
    c.execute("select [Adj Close] from StockData where Symbol = ? ", (row))
    AdjClose = c.fetchall()
    df_ta = pd.DataFrame(data = AdjClose, dtype=numpy.float64)
    df_ta = df_ta.apply(lambda c: talib.RSI(c, timeperiod = 14))
    for index, item in df_ta.iterrows():
        try:
            c.execute('''UPDATE StockData SET RSI = ? where Symbol = ? ''', (item.values, row))
        except Exception as e:
            print('Update Error: ' + str(e))
    print('Updated' + str(row))        
    conn.commit()
print ("Number of rows updated: {}".format(c.rowcount))
Error -- Update Error: Error binding parameter 1 - probably unsupported type.
Reply


Messages In This Thread
Unable to Update SQLite Table - by sambanerjee - Sep-29-2020, 02:45 PM
RE: Unable to Update SQLite Table - by Larz60+ - Sep-29-2020, 03:26 PM
RE: Unable to Update SQLite Table - by sambanerjee - Sep-29-2020, 03:42 PM
RE: Unable to Update SQLite Table - by Larz60+ - Sep-30-2020, 12:30 AM
RE: Unable to Update SQLite Table - by sambanerjee - Sep-30-2020, 12:15 PM
RE: Unable to Update SQLite Table - by Larz60+ - Sep-30-2020, 12:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Using SQLAlchemy, prevent SQLite3 table update by multiple program instances Calab 3 755 Aug-09-2023, 05:51 PM
Last Post: Calab
  UPDATE SQLITE TABLE - Copy a fields content to another field. andrewarles 14 4,404 May-08-2021, 04:58 PM
Last Post: ibreeden
  How to update values in a pyarrow table? xraphael75 1 3,679 Jan-25-2021, 02:14 PM
Last Post: xraphael75
Question Python + Google Sheet | Best way to update specific cells in a single Update()? Vokofe 1 2,687 Dec-16-2020, 05:26 AM
Last Post: Vokofe
  How to create db table with SQLite and SQLAlchemy?? marcello86 1 2,317 Sep-02-2020, 03:05 PM
Last Post: marcello86
  how to use items combobox in table name sqlite in python hampython 1 2,686 May-24-2020, 02:17 AM
Last Post: Larz60+
  unable to update packages russianponchik 0 1,652 Mar-29-2020, 04:18 PM
Last Post: russianponchik
  Unable to read update access DB saaketh 1 1,971 Sep-24-2019, 11:37 AM
Last Post: Malt
  Updating records 1 to n on an SQLite table KevinBrown 2 2,651 Mar-30-2019, 05:02 PM
Last Post: KevinBrown
  sqlite: INSERT using a variable for table name DT2000 3 6,595 Feb-23-2019, 06:28 AM
Last Post: DT2000

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020