Learn Python DECORATORS in 10 mins

Veröffentlicht am: 22 Mai 2026
auf dem Kanal: 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


Auf dieser Seite können Sie das Online-Video Learn Python DECORATORS in 10 mins mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Ankit Bansal 22 Mai 2026 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 3,773 Mal angesehen und es wurde von 204 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!