17 questions
0
votes
0
answers
49
views
Executing stored procedure via python doesn't modify data but via ssms or data studio works
I have a stored procedure in azure sql database which moves data from staging table to target table.
When I run the procedure manually, data moves:
exec [Construction].[uspProcess] 'Equipment',26
So ...
-1
votes
2
answers
45
views
How to get final inserted sql records count using python
I have script where i can read data and did transformation and inserted to database using python
But transformed data is inserting loop wise so when i try to get cursor.rowcount it showing every ...
1
vote
1
answer
94
views
Creating an SQL where condition dynamically from a list of dicts
I am currently working on a requirement where I need to build a SQL from a JSON that has details like TABLE_NAME, columns to select, and conditions for the where clause. I am using the sql package in ...
-1
votes
2
answers
126
views
how to fill a database table using a for loop in postgresql?
artist_name = ['Madonna', 'Slayer', 'Disturbed', 'Michael Jackson', 'Katty Parry']
with conn.cursor() as cur:
for artists in artist_name:
id_num = 0
id_num += 1
cur.execute(...
1
vote
1
answer
78
views
I'm having problems trying to insert a varying number of values in a column, python-sql
Im new to sql, I have been trying to make a function that will allow creation of new columns and to fill it.
Its been giving these two errors:
Failed executing the operation; Not all parameters were ...
0
votes
0
answers
24
views
Python-SQL Error : Commands out of sync; you can't run this command now [duplicate]
I am facing the error mentioned in the title when I try to run this code. (this is a part of a bigger project).
Basically, for some reason, it is not allowing me to insert rows into my table after ...
-1
votes
1
answer
63
views
SQL where between compares only the days not the full date
I'm using sqlite3 in my python local application.
I'm getting one of the weirdest bugs ever, I have a column named date_bought, with date values from 28/08/2023 to 30/08/2023.
Executing this SQL query ...
0
votes
0
answers
116
views
Is there a way I can match the records from sql database to tkinter entry text?
"Recently, I was working on a project to learn more about the SQL-Python connector. In this project, I created a simple Tkinter login page to enter usernames and passwords. Additionally, I set up ...
0
votes
1
answer
24
views
I have problems finding a solution about how to assign different descriptive names to a Combo box values in my Python - SQL project
I am currently working on a project, a windows operating system software created using python/SQL. Basically, the GUI of the software has features to add, remove, modify and search users that are ...
0
votes
1
answer
129
views
PeeWee ForeignKeyField error. IntegrityError: (1215, 'Cannot add foreign key constraint')
I have code like below:
import datetime
import peewee as pw
import os
my_db = pw.MySQLDatabase(database=os.getenv("DB_NAME"), host=os.getenv("DB_HOST"), port=os.getenv("...
-1
votes
1
answer
76
views
Unable to import name 'create_connection' from 'sql'
I am trying to use Flask on my pc but I keep getting an error whenever I import from the sql module. The error states:
ImportError: cannot import name 'create_connection' from 'sql' (C:<Directory ...
-2
votes
2
answers
931
views
Which is fastest way to update rows by id in sqlite python?
I'm using python sqlite3 package to maintain mid-size project containing more than 5 mil rows. At some moment I have to use external databases, that should update my rows by same id. Using classic ...
1
vote
1
answer
1k
views
Count with limit and offset in sqlite
am am trying to write a function in python to use sqlite and while I managed to get it to work there is a behavior in sqlite that I dont understand when using the count command. when I run the ...
2
votes
1
answer
3k
views
SQLGlot is throwing an errow when trying to parse a parameter in a SQL statement, i.e "{{parameter}}"
Example query:
SELECT * FROM table
WHERE parameter is {{parameter}}
It's throwing a sqlglot.errors.ParseError. Is there an option to enable this type of option/parameter interpolation, as found in ...
16
votes
6
answers
35k
views
Character set 'utf8' unsupported in python mysql connector
I'm trying to connect my database to a python project using the MySQL connector.
However, when using the code below,
import mysql.connector
mydb = mysql.connector.MySQLConnection(
host="...
2
votes
1
answer
3k
views
How to execute query formed by python-sql query builder?
I am using the python-sql query builder to build queries. Below is the link:
https://pypi.org/project/python-sql/
How do I execute queries from this query builder? Below is an example:
user = Table('...
1
vote
1
answer
4k
views
Python-sql, using documented example but get 'No module named 'sql.aggregate' error
I want to use python-sql as per this link. python-sql project home. I install sql using "pip install sql", and it goes as planned. However, when I place the import at the top of my module;
from sql ...