sqlite

How to remove a specific column value from SQLite Row Object in Python

How to remove a specific column value from SQLite Row Object in Python Question: So, I am fetching a record from a table in SQLite but I don’t want to include the first column which is "id" and primary key in the table. But I can’t seem to achieve that. After fetching a row, I …

Total answers: 1

Weird result with sqlite in python

Weird result with sqlite in python Question: I’m trying to get a count of document where the email of my user appear, I’m doing this for every user so I use a loop which takes every email of my user that got a document (to avoid having people with 0 document). So I know for …

Total answers: 1

Flask SQLAlchemy created an instance folder?

Flask SQLAlchemy created an instance folder? Question: Flask app. I have a database using sqlite called market.db. I have configured it in my app.py like this: app.config[‘SQLALCHEMY_DATABASE_URI’] = ‘sqlite:///market.db’ Then when I run flask shell, it created a folder instance/. Then I ran db.create_all(), and that created a database inside of that instance/ folder. I …

Total answers: 2

Convert CSV style

Convert CSV style Question: I have a CSV file that is formatted in a way that I am unfamiliar with. The file contains hourly mean power output over a whole year for a couple of generators and the water level in the reservoir of a hydropower plant. These are the first 17 lines (4 hours) …

Total answers: 1

How to fetch data in Python from SQL as a list of strings instead of tuples?

How to fetch data in Python from SQL as a list of strings instead of tuples? Question: I’m trying to get the columns names of an SQLite table, but I’m getting back a list of tuples with the names. cur.execute(”’SELECT name FROM PRAGMA_TABLE_INFO(‘Emails’)”’) .fetchall()) If I print this the output is: [(’email’,), (‘count’,)] How can …

Total answers: 1

Why am I getting this error when creating two buttons in python appJar?

Why am I getting this error when creating two buttons in python appJar? Question: I am building a simple GUI using appJar for a library system I made for school. I’m trying to make a function that allows users to either upvote or downvote a book (books are stored in a sqlite3 database) given the …

Total answers: 2

Python datetime.date.today() not formatting inside sqllite3

Python datetime.date.today() not formatting inside sqllite3 Question: In my database query which is executed with the sqlite3 module I insert a new row of data which includes a date field. The problem is when getting todays date with datetime.date.today().strftime(‘%Y-%m-%d’) which outputs ‘2023-02-06’ (expected output), it changes inside the database to ‘2015’. Why does this happen? …

Total answers: 1

convert csv to sqlite but i don't know if column valid

convert csv to sqlite but i don't know if column valid Question: i want white function in python to convert csv to sqlite. in csv, i have 4 columns Setting State Comment and Path. Sometimes the real Path is in the next column or two next columns not every time in Path column. def csv_to_sqlite(csv_file, …

Total answers: 3

Django & SQLite.db – data is duplicated

Django & SQLite.db – data is duplicated Question: I created 2 models in the Django framework. The first model is responsible to save emails and the second model to save messages. All emails and messages are saved in the SQLite.db. But when I add the same emails multiple times, the data base creates a new …

Total answers: 2