Skip to content
Advertisement

Delete sql table rows from python

I can successfully connect my python notebook with sql server this way :

JavaScript

Let’s take this sample dataframe :

JavaScript

I have a sql table with the same columns, named table_name.

Objective :

I want to delete in table_name all the rows where a row in df has the same Name, same Date, same Status, and Max = 0 (only in table_name, not necessary in df)

I tried the following but it doesn’t work :

JavaScript

Could you please help me to understand what is wrong ?

Advertisement

Answer

Different libraries use different symbols for their placeholders. The one you are using apparently uses ? instead of %s.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement