[Python] Best way to convert FastAPI/SQLmodel into Polas Dataframe?

Discussão em 'Python' iniciado por Stack, Julho 16, 2025.

  1. Stack

    Stack Membro Participativo

    What is best way to convert a FastAPI query into a Polars (or pandas) dataframe.

    Co-pilot give this.

    with Session(engine) as session:
    questions = session.exec(select(Questions)).all()
    questions_json = [q.dict() for q in questions]

    df = pl.DataFrame(questions_json)


    Do we always have to convert the results into json first? or is there some Polars way to read the data?

    Thanks.

    Continue reading...

Compartilhe esta Página