Skip to content

Tag: sql

Python SQL: storing objects or iterables

Assume I want to store via sqlite3 a simple list of strings: or a python object with properties and methods. What I tried so far is to serialize (pickle) my_list, and the returned byte representation is b’x80x03]qx00(Xx01x00x00x00aqx01Xx01x00x00x00bqx02Xx01x00x00x00cqx03e.’. However, cannot be st…

How to pivot in postgresql

I have table like following,and I would like to transform them. I’d like to pivot like following. I tried like following statement, but it returned a lot of null columns. And I wonder I must add columns one by one when new type will be added. If someone has opinion, please let me know. Thanks Answer dem…

SQL: How to divide column by counts?

So I have this query This will print something like device_id paper_count 1 5000 2 10000 And I have this other other query that will return the number of times the toner has been changed according to some date. I used count to count the number of times it’s been changed. This will print something like d…

TypeError: Argument 2 must be Tuple or List

I have built a GUI using TKinter. There I want to output the stored data and change them individually. Using the UPDATE command, I want to update the data in the table. I use MariaDB as database. I’m getting this error: Here is the complete function: Any suggestions where I’m doing wrong? Answer A…