Skip to content

Commit

Permalink
Removed pyodbc due to errors on linux systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Minue committed Jul 2, 2024
1 parent 7284822 commit a0ee963
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
Binary file added dist/pysqltools-0.2.2-py3-none-any.whl
Binary file not shown.
Binary file added dist/pysqltools-0.2.2.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pysqltools"
version = "0.2.1"
version = "0.2.2"
description = "PySQLTools"
authors = ["Pablo Minué"]
license = "None"
Expand Down
5 changes: 3 additions & 2 deletions pysqltools/src/connection/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import mysql.connector
import pymssql
import pymysql
import pyodbc

# import pyodbc
import sqlalchemy
import trino

Expand All @@ -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,
Expand Down
26 changes: 26 additions & 0 deletions pysqltools/src/log/log.py
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down Expand Up @@ -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

0 comments on commit a0ee963

Please sign in to comment.