Skip to content
Advertisement

Tag: python

fetchall() not working even with values in database

I am working in python with sqlite3 and I am trying to create a database. I created a table: c.execute(“CREATE TABLE persoane (nume text, varsta integer, salariu integer)”) Then I added the values into the table: c.execute(“INSERT INTO persoane VALUES(‘David’, 16, 1000)”) When I try to get the values out of the database with fetchall() I get an empty list

Exploding the group by cel in individual cases

I am trying to convert the following table (fictitious): Person year price Tom 2019 100 Klaas 2020 100 John 2019 120 John 2020 120 Klaas 2020 150 Klaas 2020 150 John 2020 150 into: Person year price price price Tom 2019 100 NaN NaN Klaas 2020 100 150 150 John 2019 120 NaN NaN John 2020 120 150 NaN In

SQLite update data from one table to another

I’m trying to insert some data from one SQLite database to another. I have 2 tables called “members” and “attendance.” What’s supposed to happen is, everytime a new member is added into the member table (or removed), the name and ID of the specific member should also be added to the attendance table. Picture below shows what I’m trying to

How to set up sqlite to be local server (on lan)

Current situation : I have one GUI program(written by python) which using sqlite data stored on my computer. Wishlist: I would like to have one server computer to locate sqlite data (DATA A1) (CRUD operation needed) and ten more client computer using GUI program(written by python) which connect with the sqlite data (DATA A1) on lan. I have no idea

Want to run a query multiple times using a for loop and add each result into a dictionary. This code only execute once even as it loops through

I have a query that take a random sample of records. I want to do this multiple times and add each result into a dictionary, which I will concat into a pandas DataFrame later. This code only execute once even as it loops through. Answer cursor.fetchall() doesn’t execute the query, it just fetches the remaining results from the query that

SQLite Insert Distinct from 2 variables

I have a SQLite DB with a table with the following kind of data: What I need to do is take columns B and C, create a single unduplicated list and autoincrement the primary key for the unique values. It needs to check to make sure an entry is not already existing – so the second table would be: I

while Convert sql query to json getting wrong output

I am getting wrong output Output should be: Answer The problem is with your nested loops. You actually want to parallely iterate both lists. The lists themselves are quite complex due to the nesting of lists and tuples. That’s why you may loose track here. You could try simplifying the lists/objects if possible or storing parts of them in extra

Advertisement