sql

I created a table and I'm trying to modify it but I get this error

I created a table and I'm trying to modify it but I get this error Question: I started tody with Python SQL Database conexion (or in general python databse collection i guess) and I was following a tutorial on youtube about how to create and modify the table, but at the moment when I tried …

Total answers: 1

PySide6: How to clear the values of all QPlainTextEdit and QComboBox elements after inserting data into a database?

PySide6: How to clear the values of all QPlainTextEdit and QComboBox elements after inserting data into a database? Question: Hy, i want to clear all qtextedit,qcombobox etc.., when a product is inserted in database,but i dont know, how to do it. Right now this is my function def commit(self): self.inserebd() tree_data=self.dadostree() self.contarserie() sql = """INSERT …

Total answers: 1

SQL INSERT but increment ID if exist without having to do separate SELECT query

SQL INSERT but increment ID if exist without having to do separate SELECT query Question: I have a table with Primary Key on two columns: ID (Users ID) and SQ (Sequence, this starts at 1 and increments +1 for each ID). A user should not have multiple instances of the same sequence #. Here is …

Total answers: 2

Trying to use Python variable names in psycopg2 queries

Trying to use Python variable names in psycopg2 queries Question: I am writing part of a Python program where I query a PostgreSQL table called stockNames and use the results to print information based on user input. stockNames has the following layout: company stockTicker industry Starbucks SBUX Food/Beverage … I also have a series of …

Total answers: 1

Can't write to file in Google Cloud

Can't write to file in Google Cloud Question: Currently, I have an SQL Database that I wish to edit locally. This is for a flask app made in python 3, using sqlite3. con = sqlite3.connect(‘Database/accounts.db’) cur = con.cursor() cur.execute(f"INSERT INTO Requests (Type, Argument, Priority, Time) VALUES (‘{a}’,'{b}’,{c},'{d}’)") con.commit() Except I keep getting the error: attempt …

Total answers: 2

Get last actual data

Get last actual data Question: There is a table rule_chains: ID payroll_type_id stuff_department_id start_date 1 1 89 2023-03-01 2 2 89 2023-03-01 3 1 89 2023-04-01 My problem is to get the actual entity for today. For example today is 2023-03-01 and I need to get this two entity with id = 1 and id …

Total answers: 1

SQL Query in python file shows up as "COLUMNS" instead of "VALUES"

SQL Query in python file shows up as "COLUMNS" instead of "VALUES" Question: I am very new at this, and im trying my best but i simply cant see where im f…ing up =( I have made an SQL Query in my python file. I want to write to my Azure database table –> make …

Total answers: 1

How to pass parameter to raw sql in Django

How to pass parameter to raw sql in Django Question: I am trying to create a simple ledger using raw SQL query in Django through my view.py. If I add my parameter value direct I get my required results but if I follow the tutorial here I get the error message below. ERROR MESSAGE ProgrammingError …

Total answers: 1

Trying to convert psycopg2 -> Python data from list tuples to dict

Trying to convert psycopg2 -> Python data from list tuples to dict Question: I have a postgreSQL table called stockdata with financial statement information for about 250 companies with the following setup: Company q4_2022_revenue q3_2022_revenue CPI Card 126436000 124577000 Zuora 103041000 101072000 … I used the psycopg2 package in Python to import this data into …

Total answers: 2

SQLite: how to concatenate JOIN

SQLite: how to concatenate JOIN Question: I have three tables in my database, related to physical exercises: exercises(id, name) tags(id, name) exercises_tags(id_exercise, id_tag) The exercises_tags table stores which tags corresponds to which exercise. One exercise can have multiple tags. Example: exercises(id, name): (1, ‘squat’) tags(id, name) (1, ‘legs’) (2, ‘quads’) (3, triceps) exercises_tags(id_exercise, id_tag) (1, …

Total answers: 1