from Consultas_SQL.conexion import get_connection

class Ftp_Service:

    """
    create table Formats (
    Id_Format int primary key identity(1,1),
    Format_Name varchar(100) not null,
    Format_Path varchar(100) not null,
    Format_Action_Description varchar(255) not null,
    Python_Path_Execution varchar(255) not null
    )
    """

    @staticmethod
    def get_path_By_id(id_format:int):
        result = None

        conn = get_connection()
        cursor = conn.cursor()
        query = """
                Select
                    Format_Path
                from
                    Formats
                where Id_Format = ?
                """
        cursor.execute(query, (id_format,))
        result = cursor.fetchone()
        cursor.close()
        conn.close()

        return result[0] if result else None