Questions tagged [sqlite3-python]

83 questions
0
votes
1 answer

Make unittest in flask use in-memory sqlite db

The complete code is hosted here The intention is to use an in-memory sqlite db for testing. However my dev instance db is being used. As I can find my data being deleted in the dev db. My tests\BaseCase.py is as follows: import…
Echchama Nayak
  • 971
  • 3
  • 23
  • 44
0
votes
0 answers

How can I send a message in telegram with APScheduler and Aiogram

I've tried to do this: sched = AsyncIOScheduler(timezone='Europe/Moscow') sched.add_jobstore(SQLAlchemyJobStore(url='sqlite:///ProjectDB.sqlite')) sched.add_job(create_note, 'interval', seconds=5, kwargs={'bot': bot, 'id':id}) with function: async…
PR. OR
  • 1
  • 2
0
votes
0 answers

TypeError: cannot pickle 'weakref.ReferenceType' object

I've tried to shedule 2 jobs: scheduler.add_job(send_delayed_message, 'date', run_date=datetime.now() + timedelta(minutes=1), kwargs={'id': order['ID'], 'bot': bot}, id=f'{order["ID"]}_first') scheduler.add_job(send_delayed_message, 'date',…
PR. OR
  • 1
  • 2
0
votes
0 answers

complex sqlite update statement efficiency

I have an in-memory SQLite database that is being created dynamically based on user input using sqlite3 in Python3.9. I have one update statement that is an issue in terms of speed. I have simplified the case to only include the SQLite and not…
0
votes
1 answer

How to delete the dates? (sqlite3)

This is my data base I want to delete all the dates with day 26, for example But code like this doesn't work: CURSOR.execute(f"SELECT * FROM {name}_schedule WHERE date == {date}") I do not know sql at all, so idk what to do :c
PR. OR
  • 1
  • 2
0
votes
0 answers

NameError: name “x” is not defined

> import tkinter > import tkinter as tk > from tkinter import ttk > from tkinter import messagebox > import sqlite3 # CREEAREA APLICATIEI + CONFIGURAREA ACESTEIA root = tk.Tk() root.title("Raport 1.0d") frame = tk.Frame(root) frame.pack() #…
0
votes
0 answers

AttributeError: 'str' object has no attribute 't', can someone help me correct this code?

i want to loop and iterates over a list of symbols in chunks and retrieves daily bars data using my alpaca API credentials. Then inserts the retrieved data into a database table named stock_price using SQL INSERT statements. i run the code and was…
fredderby
  • 1
  • 1
0
votes
1 answer

How to Resolve Syntax Error of the sqlite3.connect.cursor.execute() Function

I'm creating an exercise database Python script using the SQLite3 library & following a very helpful YouTube guide, & I'm running into issues near the very beginning of just creating the database in the first place. Please take a look at my code…
0
votes
0 answers

Efficient way to build a Dataframe in a for loop from a large dataset

I'm trying to build a new Dataframe, which will be converted into a SQLite3 database, with data from three different Dataframes read from three SQLite3 files. The ideia is that, for each item in UNTRMT, I have to find which items in UCBT are related…
0
votes
0 answers

Getting a Fatal Python error: PyEval_RestoreThread, app breaking on compilation

Although my application works just fine when running it from my IDE, compiling it presents this error: sqlite3.OperationalError: unable to open database file Fatal Python error: PyEval_RestoreThread: the function must be called with the GIL held,…
0
votes
1 answer

How do I pass data from my html flask to my sqlite3 database(python)

I am trying to make an app where the user put's in a couple of inputs and i need the inputs to go to my database and my other page which is results which will show it i already don't where it sends to the other page i am having a problem trying to…
0
votes
0 answers

Format My Sqlite Code by python sqlite3 and VScode

When I use Sqlite3 in python I want to arrange my code and color it so that it helps me to understand it and find my mistakes. I use VSCode code editor and also Extintion Python installer. any help, this Photo to my problem, It shows that the code…
0
votes
1 answer

How to fix a python exception, sqlite3 OperationalError? Table history has 3 columns but 4 values were supplied

Hello I've been attempting to fix an issue with a python OperationalError in a sqlite3 database. I am using a question mark as a placeholder for an insert statement. But I am getting the following message. db.execute("UPDATE accounts SET balance = ?…
0
votes
0 answers

How to delete a foreign key row when the key it's referencing get's deleted? [SQLAlchemy]

I have three tables: User, File, and UserFile The first stored data about users including username, email, password, and all of their files. The second stores info about files. The third connects a user to a file in order to create a list of shared…
0
votes
0 answers

user = authenticate(request,username=username) returns 'None'

I'm currently working on a Django app in which I'm trying to make a login page. I have used a custom db to store the input into. I have successfully been able to make a signup page, but for some reason I cant authenticate the user every time I try…