green-dino / Oberon

Streamlit application is focused on building a playbook by interacting with a SQLite database.
1 stars 0 forks source link

Update Fetch Suggestions method #16

Open ryaustin opened 2 months ago

ryaustin commented 2 months ago

Please update the method as reviewed on today's call:

def fetch_suggestions(column_name):
    """
    Fetch unique suggestions for specific columns.

    Args:
        column_name (str): Column to fetch suggestions from.

    Returns:
        suggestions (list): List of unique suggestions.
    """
    query = f"SELECT DISTINCT {column_name} FROM elements"
    # suggestions = [row[0] for row in fetch_query_results(query)]
    suggestions = fetch_query_results(query)    
    if not suggestions.empty:
        suggestions.get(column_name)
    # TODO: @rye What happens if suggestions is empty?
    return suggestions
green-dino commented 2 months ago

Updated the modules in utilities db_operations.py

ryaustin commented 2 months ago

Great. Feel free to close any issues that are complete.