Category : sqlite

I’m trying to update my database. I want to change None to time and while I’m running it sqlite3.OperationalError: near ":59": syntax error my code to update is : now = datetime.now() trigger_time = str(now.strftime("%H:%M")) db.execute(f"""Update Signals set Triger_Time = {trigger_time} where ID = {int(signal_id)}""") SOLVED BY (https://stackoverflow.com/a/69661333/16613629) Answer : You forget about quotes around ..

Read more

I have a function getMoverList() that needs to SELECT Names from a sorted sqlite3 column: def getMoverList(): conn = get_db_connection() cur = conn.cursor() cur.execute(‘SELECT Name, CAST (Points AS int) as Points, FROM table ORDER BY Points DESC’) moverList = [] for Name in cur.fetchall(): playerName = str(Name[0]) moverList.append(compareRanks(playerName)) return moverList conn.close() The function has to ..

Read more

python 3.7, vscode This works: def insert_song(cursor): header = get_header(cursor) query = "INSERT INTO `songs` (‘song’, ‘album’, ‘artist’, ‘genre’, ‘duration’, ‘price’) VALUES (?,?,?,?,?,?);" cursor.execute(query, get_info(cursor)) connection.commit() This: def insert_song(cursor): header = get_header(cursor) query = "INSERT INTO `songs` ({}) VALUES (?,?,?,?,?,?);".format(header) cursor.execute(query, get_info(cursor)) connection.commit() generates following error: sqlite3.OperationalError: near "(": syntax error the return of the ..

Read more