sqlite

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: './instance/test_db.sqlite'

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: './instance/test_db.sqlite' Question: I’m having a trouble with tear down of my pytest context. I have a Flask app which creates sqlite3 database in my instance directory, looks like this: # ./src/app_factory/__init__.py def create_app(): app = Flask(__name__, instance_path=f'{os.path.abspath("instance")}’, instance_relative_config=True, …

Total answers: 1

How do I update the password?

How do I update the password? Question: I am working on a web app and I want a user to be able to reset their password but I’m failing to do so how can I do it? I also tried email = request.form.get(’email’) new_password = request.form.get(‘password’) user = User.query.filter_by(email=email).first() If user : user.password = new_password. …

Total answers: 1

My HTML is not sending the POST method to the flask app function

My HTML is not sending the POST method to the flask app function Question: What’s happening: I have an HTML code that is sending a POST request to the flask code. It’s for a Login page. (I’m using SQLite3 and Flask.) The HTML code: <div class="col"> <div class="login-box"> <h2>Register</h2> <form method="post" action="{{ url_for(‘register_post’) }}"> <div …

Total answers: 1

python – split query results into multiple objects based on one column

python – split query results into multiple objects based on one column Question: my program is querying a sqlite database, and thre result is like this (simplified) in the cursor ready to be fetched. connection = sqlite3.connect(IMAGE_LOG_DB_PATH) connection.isolation_level = None cur = connection.cursor() sql_query = "Select date, name, count(*) as sells from sellers group by …

Total answers: 1

sqlite: error when using another sqlite command inside a custom function (sqlite3.Connection.create_function)

sqlite: error when using another sqlite command inside a custom function (sqlite3.Connection.create_function) Question: I’m learning to create custom sqlite3 functions in Python. This is my code: import sqlite3 conn = sqlite3.connect("data.db") c = conn.cursor() query = "CREATE TABLE IF NOT EXISTS names (ID INTEGER UNIQUE PRIMARY KEY NOT NULL, name TEXT)" c.execute(query) query = "INSERT …

Total answers: 1

SQLite: how to concatenate JOIN

SQLite: how to concatenate JOIN Question: I have three tables in my database, related to physical exercises: exercises(id, name) tags(id, name) exercises_tags(id_exercise, id_tag) The exercises_tags table stores which tags corresponds to which exercise. One exercise can have multiple tags. Example: exercises(id, name): (1, ‘squat’) tags(id, name) (1, ‘legs’) (2, ‘quads’) (3, triceps) exercises_tags(id_exercise, id_tag) (1, …

Total answers: 1

Counting distinct values across columns using sqlite3 in python

Counting distinct values across columns using sqlite3 in python Question: I’m trying to count distinct values across columns using sqlite3 in python but cant seem to get the correct results. Am only able to get the count of distinct values in 1 column. I’ve create a database and imported the csv file as a table …

Total answers: 4

Attempting to do detail validation on a db created in sqlite 3 using python

Attempting to do detail validation on a db created in sqlite 3 using python Question: I’m transitioning from keeping and checking login files on a text document to from a SQL database. In my current solution, I have got it working where I can check the file for the username and password and then report …

Total answers: 1