Questions tagged [sqlite3-python]

83 questions
0
votes
0 answers

SQLite PRIMARY KEY and FOREIGN KEY definition

I think I do a failure in the tables definition for PRIMARY KEY and FOREIGN KEY. The import and creation works fine in a sqlite3 database. No error message. This is my declaration: CREATE TABLE "contact" ( "id" INTEGER NOT NULL, "uniqueid"…
Hermann12
  • 1,709
  • 2
  • 5
  • 14
0
votes
1 answer

sqlite3.OperationalError: no such table: auth_user

I'm developing a simple app using Django. I am done with the development and I'm trying to push to Heroku server. I get this error if I try to create a superuser You have 21 unapplied migration(s). Your project may not work properly until you apply…
0
votes
1 answer

Is it possible in SQlite3 python that if a row has been previously updated, it cannot be updated for like 5 seconds

In a database table, if a specific row has been previously modified or updated, I want that row to not be changed or cannot be modified for let's say I set in 5 seconds even if the program is trying to modify that row, then after that the row can be…
0
votes
1 answer

TypeError: The view function did not return a valid response. Flask

So, I am making a website to make blogs. It keeps on giving me the error: TypeError: The view function for 'createblog' did not return a valid response. The function either returned None or ended without a return statement. But the problem is in my…
0
votes
0 answers

TypeError: 'PasswordField' object is not subscriptable

I am working on a user authentication system allowing users login with password and email. But I keep getting error 500. I checked and saw this error (this is only part of the error): 2023-05-12 10:53:09,480 INFO sqlalchemy.engine.Engine \[generated…
Mercy AI
  • 1
  • 1
0
votes
1 answer

json query for python sqlite3 in Conda env and python.org release env

import os import sqlite3 g_rdb_path = 'mails.db' def test(): c = sqlite3.connect(g_rdb_path) t = c.cursor() t.execute('''SELECT m_mail_info.id FROM m_mail_info, json_each(m_mail_info.froms) WHERE json_each.value LIKE '%{0}%' …
Arthur
  • 63
  • 1
  • 8
0
votes
1 answer

How to stop `pandas.read_sql_query` is reformatting dates?

I am connecting to a sqlite database which has date columns which are strings. The dates are formatted as "dd/mm/yyyy". It seems like no matter what I try, when querying the database with pandas.read_sql_query() the string is reformatted to…
nick
  • 105
  • 6
0
votes
0 answers

unspecified column being added to sqlite3 database

I am accessing my brokers API and downloading my open positions in derivatives and storing in a database. what I cant understand is - when the table portfolio_position is created an unspecified column called 'Unnamed : 0 ' is added. The last part…
0
votes
1 answer

Use placeholder for table name in python sqlite3

I was wondering if there was a way to use the '?' to create a table with a different name every time in a function. Here's my code: @bot.tree.command(name='create', description='Crea un nuovo torneo') @app_commands.describe(name='Il nome del…
0
votes
1 answer

How do I create a discord.py bot that interacts with Sqlite3?

I am creating a License Registration Discord.py bot, where I have 2 commands, /register to register your vehicle and /plate for police to look them up. I have created the register command, but I am continiously failing at the plate, one, getting…
0
votes
0 answers

Cannot update database with placeholders in sqlite3

def save_task_changes(self): con = sqlite3.connect("revisiontimetable.db") cur = con.cursor() date = self.calendarWidget.selectedDate().toPyDate() #changes to checkboxes for i in range(self.dayListWidget.count()): item =…
0
votes
0 answers

How to print fetched result in FastSQLite, there is no .cursor() like in SQLite3?

I downloaded FastSQLite for python , Readme I created a database and table, but I do not know how to print fetched results, in sqlite3 there is a .cursor() to print results, in FastSQLite there is no .cursor() method from fastsqlite import…
user1942505
  • 480
  • 5
  • 11
  • 20
0
votes
1 answer

sqlite3 row does not work to make fetchall() a dict instead of tuple

con = sqlite3.connect("funds.db") with con: cur = con.cursor() con.row_factory = sqlite3.Row funds = cur.execute("SELECT * from funds").fetchall() print(funds) Since i set con.row_factory = sqlite3.Row, i expect…
Justin Chee
  • 427
  • 1
  • 3
  • 14
0
votes
1 answer

Py-Script commit to a SQL table after submitting an html form

I have a HTML file with a button to submit a form which runs the following Py-Script code: import sqlite3 def sub(*args, **kwargs): conn = sqlite3.connect('data.sqlite') cursor = conn.cursor() fname = Element('fname').value.title() …
0
votes
1 answer

How can I solve the error regarding the storages in Optuna?

I am using optuna library for hyperparameter optimization. I am trying to create a study and a storage but i am getting the following error Traceback (most recent call last): File "/home/azureuser_rishi/JSSP/final/main_final.py", line 85, in…