#๐ not all arguments converted during string formatting SQL
20 messages ยท Page 1 of 1 (latest)
@ocean orbit
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
print(f"Aantal argumenten voor Medewerker: {len(data)}")
print(f"Data voor Medewerker: {data}")
cursor.execute("""
INSERT INTO Dim_MedVraag (MedVraag4, MedVraag5, MedVraag6, MedVraag7, MedVraag8,
MedVraag9, MedVraag10, MedVraag11, MedVraag12, MedVraag13,
MedVraag14, MedVraag15, MedVraag16)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
RETURNING PK_ID;
""", data)
medvraag_id = cursor.fetchone()[0]
cursor.execute("""
INSERT INTO Fact_Antwoord (FK_Locatie, FK_Periode, FK_Rol, FK_MedVraag)
VALUES (%s, %s, %s, %s);
""", (locatie_id, periode_id, rol_id, medvraag_id))
Job
Location
Period
question 4 till 15
Text
?
what does the len(data) in the first line output?
Aantal argumenten voor Medewerker: 16
cuz i only have the questions
Job
Location
Period
seperate?
no idea what that means
you got 13 parameters in your query, but try to give it 16. that's three too many in your data structure.. you need to figure out why it's too many, and which ones need to be removed
what library are you using?
i am using postgres so psycopg2
ah ok
lemme check with the cutsomer will print it there too and see
13 yeah seems like i made a mistake there then thank you added the location and period seperate in there
then i know the problem ๐
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.