Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sqlite3 delete row python

import sqlite3

def deleteSqliteRecord(id):
    try:
        sqliteConnection = sqlite3.connect('SQLite_Python.db')
        cursor = sqliteConnection.cursor()
        print("Connected to SQLite")

        sql_update_query = """DELETE from SqliteDb_developers where id = ?"""
        cursor.execute(sql_update_query, (id,))
        sqliteConnection.commit()
        print("Record deleted successfully")

        cursor.close()

    except sqlite3.Error as error:
        print("Failed to delete reocord from a sqlite table", error)
    finally:
        if sqliteConnection:
            sqliteConnection.close()
            print("sqlite connection is closed")

deleteSqliteRecord(5)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas series quantile 
Python :: timestamp e datetime python 
Python :: django admin customization 
Python :: python3 add dictionary to dictionary 
Python :: SciPy 1D Interpolation 
Python :: impute mode pandas 
Python :: how to use inverse trigonometric functions in python 
Python :: python how to find gcd 
Python :: pyttsx3 set volume 
Python :: set camera width and height opencv python 
Python :: django logout user 
Python :: python: measure time code 
Python :: transpose array python 
Python :: randomly choose between two numbers python 
Python :: python capture desktop as video source 
Python :: django login_required decorator 
Python :: python convert string datetime into datetime 
Python :: python program to solve quadratic equation 
Python :: Python Removing Directory or File 
Python :: how to add a function in python 
Python :: pandas gropu by 
Python :: calculate age python 
Python :: change x axis frequency 
Python :: python remove spaces 
Python :: assert keyword python 
Python :: python do nothing 
Python :: python tuple to list 
Python :: concatenate 2 array numpy 
Python :: pandas dataframe to parquet s3 
Python :: wordle python 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =