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ytJg2z-1GY14e{TD
zLA$vA*B*8&|NnzL2Rt@08l?G8pg@YV=ooG7H62u!*#ee)B_h!d7xTFZvWUIKYgUga
z%f4fAm?MqEUADUm5W?XIqorM+9XQ_NKmXR=^G^#0lwnhZJCE4+J6)sQZanK5Esgx>
z&eY*hO2T5J5qkq#C4Ble^aD_BfU2eXm@7cx7Uq18%46U3&K4MCy<6WXrCUK;Aa=$>=nmb;>g@gXL-(kU%rJXSXTUIl!WJHJ;&d;U%!-HUP-i
zL4s*K>y~G8$SsLYYl-ec14}c8yeaNK6@4BW?R9+)qNU{rXPxG$;~}|F8@7$@wQX3s
zju)?{(#^-BG_`D9X&NFqy4b4DntXTC^&sn#FSd!{T}$&3`I^={uF
z1K6>-2^nBqU=D&yok8fM`x&fE4d6+?dgA(?qCO^Qi31lx
z6NcMd#6IB5L9~L%rL9YLjzy$UBaM~QGS&=(Q*EiEFuy{6T?#9ZU?jp)j7hG{hw`%;
z;p-&r_6ha2o>Ofiuvmo8$RJxo5L4!2N<~n+2{Vg*O|c`lWPxNk5te)zrp6aQd>ZzXUsh)5D{2w(1tc3u`001WWnxg;!
literal 0
HcmV?d00001
diff --git a/pyproject.toml b/pyproject.toml
index e48dbdb..9933dc8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pysqltools"
-version = "0.2.1"
+version = "0.2.2"
description = "PySQLTools"
authors = ["Pablo Minué"]
license = "None"
diff --git a/pysqltools/src/connection/connection.py b/pysqltools/src/connection/connection.py
index c571ce3..def3384 100644
--- a/pysqltools/src/connection/connection.py
+++ b/pysqltools/src/connection/connection.py
@@ -6,7 +6,8 @@
import mysql.connector
import pymssql
import pymysql
-import pyodbc
+
+# import pyodbc
import sqlalchemy
import trino
@@ -27,7 +28,7 @@ def __init__(
trino.dbapi.Connection,
pymssql.Connection,
sqlite3.Connection,
- pyodbc.Connection,
+ # pyodbc.Connection,
mysql.connector.connection.MySQLConnection,
mysql.connector.connection_cext.CMySQLConnection,
ibm_db.IBM_DBConnection,
diff --git a/pysqltools/src/log/log.py b/pysqltools/src/log/log.py
index 55b5721..0b252ea 100644
--- a/pysqltools/src/log/log.py
+++ b/pysqltools/src/log/log.py
@@ -1,11 +1,14 @@
"""Logger"""
import logging
+from typing import Any, Callable
import pandas as pd
+import rich
from rich.console import Console
from rich.logging import RichHandler
from rich.markdown import Markdown
+from rich.progress import Progress
from rich.table import Table
COLORS = [
@@ -70,3 +73,26 @@ def add_title(self, title: str):
md_ = f" # **{title}** "
md = Markdown(md_)
self.console.print(md)
+
+
+def progress_function(
+ task_name: str = "Task in progress...", color: str = "green", total: int = 100
+):
+ """
+ Decorator to use a rich progress bar
+ """
+
+ def decorator(fun: Callable[..., Any]):
+ """Decorator"""
+
+ def inner(*args, **kwargs):
+ """Wrapped"""
+ with Progress() as progress:
+ task = progress.add_task("f[{color}] {task_name}...", total=total)
+ result = fun(progress, task, *args, **kwargs)
+ progress.update(task, advance=total)
+ return result
+
+ return inner
+
+ return decorator