Skip to content
Advertisement

Tag: python

Counting unique values within a time window

I have data that looks like (over 100.000 rows): What I would like: Explanation CONTEXT I want to find out how many people (person) are working in the same location (Location) by looking at a time window (timestamp) of max 10 minutes and checking whether a person is really working simultaneously or just taking over their shift within that frame.

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 stored within a BLOB variable. Should I use a string variable instead, or should I find a way to

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 As the error suggests, the 2nd argument

Is a SQL trigger faster than a if statement on a interface [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year. Improve this question In a big data scenario, where a piece of code has to run tens of thousands of times would checking the integrity

Unable to use Cursor in separate function

I’m currently tryign to learn how to use SQLite3 and am trying to seperate setting up the DB through functions. My second function is where I’m having the error : AttributeError: ‘NoneType’ object has no attribute ‘cursor’. After looking at the SQLite3 doucmentation, I got the impression that it’s best to seperate diffrent methods for the DB into diffrent functions.

Data is not inserted MSSQL Python

I am doing a python script to add text files into an MSSQL table. Using pyodbc, I’m doing it. The data is not inserted in the result. There is no error showing when running. Here is my code, Answer You’re missing a call to cnxn.commit() after the loops are done.

Sqlite3 in Python not fetching data

I have a sqlite3 DB with a few rows in it. When I try to fetch data from it in Python, fetchall returns an empty list. The data is being inserted in a different part of the project fine. I verified this by opening the DB in “DB Browser for SQLite” and running the following command. This returned the data

Advertisement