Learn Python DECORATORS in 10 mins

Published: 22 May 2026
on channel: Ankit Bansal
3,773
204

A decorator in Python is a function that takes another function, adds extra functionality to it, and returns the modified function without changing the original function’s code.

from datetime import datetime

def etl_logs(func): # handle_failure(load_table)
def wrapper(*args,**kwargs):
print("load starting")
print("start time", datetime.now())
func(*args,**kwargs)
print("load done")
print("end time", datetime.now())
return wrapper

def handle_failure(func): #etl_logs(load_table))
def wrapper(*args, **kwargs):
try:
func(*args, **kwargs)
except Exception as e:
print("job failed")
print("error:", e)
return wrapper

handle_failure(etl_logs(load_table))

@handle_failure
@etl_logs
def load_table(tablename , schema , databasename):
write code here
print(f"loading data into {databasename}.{schema}.{tablename}")
a=1/0
print(a)


load_table('sales', 'dbo' ,'namastesql')


Zero to hero(Advance) SQL Aggregation:
   • All About SQL Aggregations | SQL Advance |...  

Most Asked Join Based Interview Question:
   • Most Asked SQL JOIN based Interview Questi...  

Solving 4 Trick SQL problems:
   • Solving 4 Tricky SQL Problems  

Data Analyst Spotify Case Study:
   • Data Analyst Spotify Case Study | SQL Inte...  

Top 10 SQL interview Questions:
   • Top 10 SQL interview Questions and Answers...  

Interview Question based on FULL OUTER JOIN:
   • SQL Interview Question Based on Full Outer...  

Playlist to master SQL :
   • Complex SQL Questions for Interview Prepar...  

Rank, Dense_Rank and Row_Number:
   • RANK, DENSE_RANK, ROW_NUMBER SQL Analytica...  

#python #dataengineer #decorators


On this page of the site you can watch the video online Learn Python DECORATORS in 10 mins with a duration of hours minute second in good quality, which was uploaded by the user Ankit Bansal 22 May 2026, share the link with friends and acquaintances, this video has already been watched 3,773 times on youtube and it was liked by 204 viewers. Enjoy your viewing!