EDIT: I found out that my script for inserting data was deleting zeros that are the first digit. Still don't know why this happens but my problem is solved for now.
I'm trying to send a query via mysql-connector to my database, but I keep getting errors. I can't manage to execute without single quotes (') because it returns syntax errors or mysql errors. I seem to have to use a tupel, but this comes with the disadvantage of single quotes.
mycursor.execute("CREATE TABLE IF NOT EXISTS rki (
ObjectId INT(255),
IdBundesland INT(255),
Bundesland VARCHAR(255),
Landkreis VARCHAR(255),
Altersgruppe VARCHAR(255),
Geschlecht VARCHAR(255),
AnzahlFall INT(255),
AnzahlTodesfall INT(255),
Meldedatum VARCHAR(255),
IdLandkreis VARCHAR(255),
Datenstand VARCHAR(255),
NeuerFall INT(255),
NeuerTodesfall INT(255),
Refdatum VARCHAR(255),
NeuGenesen INT(255),
AnzahlGenesen INT(255),
IstErkrankungsbeginn INT(255),
Altersgruppe2 VARCHAR(255)
)")
lk = "05366"
mycursor = mydb.cursor()
query = ('SELECT Landkreis FROM rki WHERE IdLandkreis = %s')
mycursor.execute(query, (lk,))
print(mycursor.statement)
kreisname = mycursor.fetchone()[0]
As you can see in the pictures executing with '' does not work, while a query without works like a charm. Is there any way to do this in python?