Learn Python DECORATORS in 10 mins

Publicado em: 22 Maio 2026
no canal de: 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


Nesta página do site você pode assistir ao vídeo on-line Learn Python DECORATORS in 10 mins duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Ankit Bansal 22 Maio 2026, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 3,773 vezes e gostou 204 espectadores. Boa visualização!