133 questions
1
vote
0
answers
578
views
How to properly store a date time value in a sqlite3 database with python
I wanted to store a timestamp from Python in a sqlite3 database. For that I used this kind of code
from datetime import datetime, date, timedelta, time
import sqlite3
import os
def main():
...
0
votes
0
answers
270
views
discord.py "Unknown Webhook 10015" since new router
Ever since getting my new router (HG8147X6) I seem to have constantly run into an issue with my Discord.py bots.
After starting the bot, every slash command works once, then all of them fail (I get ...
0
votes
0
answers
36
views
Using Arrow ADBC to register UDF
While chasing down performance and cleaner code, I've ran into this problem I've found that UDF's are seemingly connection dependent, not database dependent. If I, for instance, used a trigger on ...
0
votes
1
answer
46
views
Flask Select query returning a cursor object or an empty list instead of a tuple of values
Here is my code in app.py:
from flask import Flask, render_template, request, g
import sys
import sqlite3
import os
current_directory = os.path.dirname(os.path.abspath(__file__))
app = Flask(...
1
vote
2
answers
142
views
ModuleNotFoundError: No module named '_sqlite3' after installing spyder-kernels 3 for Spyder 6.0 IPython console
I am trying to use Spyder 6 IDE on Ubuntu 24.04. After installation of Spyder 6, I changed the default python interpreter to my virtual environment running Python 3.11 and installed spyder-kernels==3....
0
votes
1
answer
132
views
How can I update display of chat history upon page refresh?
My chat UI using Gradio:
import sqlite3
import gradio as gr
import time
formatted_history = []
sqlite = None
def loadHistoryFromDB():
global sqlite,formatted_history
sql="SELECT role,...
0
votes
0
answers
48
views
How to prevent "OperationalError: Database is locked" from discarding changes?
I have an application that periodically records data to a database with Python's SQLite3. Unfortunately, when I open the database with DBBrowser, it can sometimes lock the database. When this happens, ...
0
votes
0
answers
33
views
"sqlite3.OperationalError: database is locked" on a brand-new database file
This code which has been working for years has now suddenly started returning the above error even for a newly created database.
Here's the relevant code snippet:
dbfile = os.path.expanduser(...
-1
votes
1
answer
123
views
Make a table SQLite in db.schema.table [closed]
I need a table in sqlite that returns data when queried with:
select * from db.schema.table
This is for testing of some other code that otherwise calls a databricks cluster / postgresdb where there ...
-3
votes
1
answer
85
views
Pandas without sqlite3
There is a transitive dependency of Pandas on sqlite3 via SqlAlchemy. Hence, if you don't have sqlite3 installed on Linux or Windows, Pandas won't run. It will show this error.
ModuleNotFoundError: ...
0
votes
1
answer
86
views
What is the correct syntax for creating a table name as variable?
The user can generate a table to rank songs. It checks if there is a ranking system for the user already, if not it creates a new table. I want the name of the system to correlate with the user id.
@...
0
votes
1
answer
133
views
A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: chat not found TELEBOT
raise ApiTelegramException(method_name, result, result_json)
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: chat not ...
1
vote
1
answer
71
views
How to add a file path into the SQLite3 database without experiencing sqlite3.InterfaceError?
Here's my code:
import sqlite3
from pathlib import WindowsPath
#Create database
conn = sqlite3.connect('file_path.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS paths (...
-1
votes
1
answer
170
views
How to check if a file exists in SQLite3
For my project I need to make a database and one of the requirements is that it must check if the file exists, I have tried but my code doesn't work when I try. I have watched many tutorials and none ...
0
votes
1
answer
171
views
sqlite3.DataError: query string is too large
I'm trying to analyze this wiktionary dump with is 5GB, but I'm getting the above error message in the title. Here is my code:
import sqlite3
conn = sqlite3.connect(':memory:')
c = conn....
-1
votes
1
answer
79
views
SQLite3 Syntax Error: Unable to Create Tables in Python
I encountered an issue while building my database. Whenever I try to run the function provided below, I encounter an unspecified syntax error.
import sqlite3
def create_all_sql():
with sqlite3....
0
votes
2
answers
56
views
OperationalError at /register/ no such table: CustomUser
models.py
from django.db import models
class CustomUser(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
email = models.EmailField(...
0
votes
1
answer
118
views
problem with connecting flask app with sqlite
i am using SQLAlchemy python module to connect flask app with sqlite database(db browser for sqlite) but i dont know how to connect it.
i have cloned a repo.
Please tell me if i have to do any extra ...
4
votes
1
answer
2k
views
Python dataclasses and sqlite3 adapters
What is the cleanest way to commit data stored in instances of a dataclass contained in a list to SQLite with sqlite3's executemany?
For example:
@dataclass
class Person:
name: str
age: int
a ...
-1
votes
1
answer
84
views
Prevent duplicate insertion based on two columns in a table
I have a table with below columns and trying to insert values real time.
TableName: ML_data
ref:
s.No colA colB colC colD
1 xxx 123 7 9
2 yyy 345 9 4
3 xxx 456 3 5
...
0
votes
1
answer
51
views
Sqlite3 doesnt save data in python
Hello I am trying to create api using flask but i am facing issue where sqlite is not saving data. here is the code below:
def data_insert(link):
try:
c.execute(f"INSERT INTO ping(...
-3
votes
2
answers
78
views
why the same functions with same querys gives a result while another not in sqlite?
I don't get it ....
i have a few functions that return rows from sqlite tables.
Problem is that some sql querys are working while another not.
Function that working perfect :
def selectAll(...
0
votes
0
answers
41
views
How to send email to the user that is logged to warn the user
I create a flask web app that monitors the gas value and current value. Also, it includes the graph for gas value and current value, the status of led, buzzer, and solenoid. When it reaches at a ...
0
votes
1
answer
98
views
I must show a photo after selecting name of airline in my tkinter app but after selecting the program becomes fully empty white screen
I have an Tkinter app, it must contain combobox with name of airlines, some text boxes (for showing description) and photo (image) but it doesn't work. I must contain everything in database (SQLite)
...
-2
votes
2
answers
66
views
Please can you tell me why my kivymd app just doesn't run without showing any error
This is 'my.py` file:
from kivy.uix.button import Button
from kivymd.app import MDApp
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.uix.floatlayout import MDFloatLayout
from kivymd.uix....