133 questions
1
vote
0
answers
586
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():
...
1
vote
1
answer
106
views
Force Python-SQLite3 to report non-existing columns in WHERE clause
This is my code:
import sqlite3
conn = sqlite3.connect(':memory:')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE schools (
county TEXT,
statustype TEXT
)
''')
cursor.execute('''
...
0
votes
0
answers
272
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
65
views
Unable to limit memory(RAM) consumption in a FastAPI based service using Sqlite / AioSqlite
I have stored strings & their vector embeddings in a Sqlite DB file with the table name "query_metadata". Embeddings are stored as numpy bytes. The embeddings would be used for ...
0
votes
0
answers
39
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
2
answers
152
views
Attaching an adbc connection to an sqlite in-memory database
I have a setup where I'm utilizing two connections for sqlite: A dbapi-based sqlite connection from Arrow ADBC so I can have access to ingesting and fetching arrow data, and a native sqlite3 ...
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(...
0
votes
1
answer
74
views
Extract information through SQLite and Python [closed]
I am working with a DataBase in Sqlite and Python with the table that is attached.
I am interested in get a query that give me a list with an unique item in IDFrom, for those unique items, the VoltMag,...
1
vote
2
answers
143
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
0
answers
47
views
Data retrieving and SQL database update
I'm trying to retrieve some data from an API and save them to a local database I created. All data come from Google Ads campaigns, and I need to make two separate calls because of their docs, but that'...
0
votes
1
answer
133
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
1
answer
70
views
Convert blob to bytes SQLite3 Python
Have a requirement of storing/retrieving bytes as a blob in SQLite3;
The column definition in as follows:"bytes_as_blob " BLOB,
Byte data is stored in the table using the following construct ...
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, ...
-1
votes
1
answer
145
views
How do I instruct Python to use my own compiled SQLite3?
I have compiled my own version of SQLite3 amalgamation tarball from the download page and would like to include that into my Python3 script on MacOs. Is there a way to do that via import sqlite3? As ...
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(...
0
votes
1
answer
89
views
Python sqlite3 cached in-memory database - is it supported?
Python 3.12, built-in sqlite3 package on MacOS Sonoma 14.5, using PyCharm community edition.
I'm attempting to create an in-memory sqlite3 database that can be closed and reopened for each query.
The ...
-1
votes
1
answer
124
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 ...
0
votes
1
answer
23
views
Sqlite database design field value depends on another field value comparable to python dict
I need your suggestion on how to design my sqlite database. I intend to have single Table for my project. In general the table would look like below.
ID
Str_ID
Group
English
German
0x01
ID_YES
Group1
...
-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
34
views
Flask sqlaclhemy db relationship not populating the other table in sqlite
I am new to flask and flask-sqlalchemy. I have created one table using below code.
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
app = Flask(__name__)
...
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
60
views
kivymd app apk cannot connect with database.db file on mobile phone
I created a Kivymd app that connects with a sqlite3 database.db file. I compiled it with buildozer and it successfully worked fine and as I saw how buildozer works, the database file cannot be seen. ...
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 ...
0
votes
0
answers
126
views
How do we separate django project into multiple docker containers
I have a django project right now that allows users to login and register an account. Sort of like a blog. All the views are separated and have their own static html file. The project works running ...
1
vote
1
answer
72
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 (...
0
votes
1
answer
46
views
Kivy RecycleView custom labels
I'm creating an app with five screens.
On four screens the user can save different kind of data (number, string, list) to an sqlite3 database.
The fifth screen is the "History Screen" where ...
-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 ...
3
votes
1
answer
3k
views
ModuleNotFoundError: No module named 'pysqlite2' when I run jupyter notebook
I'm using debian 12
I created a virtual environment using virtualenv in ~/.venv
Then I installed jupyter notebook with pip install jupyter
Now I run jupyter notebook and it throws this error
(.venv) ...
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
vote
0
answers
1k
views
Store FAISS vector store in some database like SQlite3
This is my code which I am using to load my faiss vector store and print it as a dataframe using pandas from my folder faiss index which contain two files in it. This is my directory.
faiss index
...
-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
0
answers
45
views
Trying to save to a sqlite3 database with df.to_sql(), database file stays empty
I am working on a Smile Detection Application which uses a CNN model and CV2 to capture the image of people smiling using laptop's camera. Currently the application is under development and we are ...
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
74
views
Tuple problem with parameterized SQLite query
I'm working on a telethon-based telegram chatbot that can query a customer db given a last name in the following format: /search thompson, but am having some trouble using the fill function to keep ...
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 ...
0
votes
1
answer
87
views
SQLite3 - Location of db
I have implemented SQLite3 into my discord bot, everything seems to work and I can commit rows to my db, do a select and retrieve them, however in my local directory for the project I can't see the DB ...
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 ...
0
votes
0
answers
387
views
How to fix: sqlite3.ProgrammingError: parameters are of unsupported type?
I am trying to create a ticket system, where it pulls the guild_id from SQlite3, but it does not work
I have already tried changing it so that its is defined as different things, but it does not work. ...
-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
2
answers
62
views
Adding constraint based on group by and having SQLITE3
I'm setting up a table in sqlite3 (Python). The table that I created is called test and
I need to add a constraint to this table where the number of unique entries can't be bigger than 3 for any given ...
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(...
0
votes
0
answers
95
views
How to update multiple items in database. Sqlite3, Python
I've been trying to solve this problem for a while, i have a Sqlite3 database and i am using python, what i have attempted is i have loads of titles of movies, tv shows, books etc, which i clean up ...
-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
29
views
SQLAlchemy syntax error when TRUNCATE TABLE [duplicate]
TRUNCATE TABLE my_table gives me syntax error from SQLAlchemy.
I have seen other issues where the commit didn't occur, but this isn't the case.
I really have no troubles with executing other queries ...
0
votes
0
answers
42
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
147
views
Creating child table python (sqlite3)
I am parcing site with comics. First I am parcing catalog and creating parent table with names, urls of covers and status of comics.
After that I want to create child tables for each comic with list ...
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)
...
-1
votes
1
answer
51
views
user_id takes value None after function call (telebot, sqlite3)
I am making a telegram bot using the telebot library. This function retrieves the city of residence, which was previously selected by the user in the city_living variable, from the SQL3 database.
def ...
-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....
0
votes
2
answers
1k
views
How can I open a database in read-only mode by sqlite3 in python?
I am writing a Telegram bot in Python and using a database with SQLite3 as the DBMS. As there can be multiple concurrent queries to the database, I want to restrict certain functions to read-only mode....