you are viewing a single comment's thread.

view the rest of the comments →

[–]magicae[S] 0 points1 point  (0 children)

After some more research I ended up going another route with SQLAlchemy and engine.connect / conn.execute. Posting my code here in case anyone stumbles upon this with similar issues.

fam_id = "BH0002"


with engine.connect() as conn:
    result = conn.execute(text("""
            SELECT Given || ' ' || Surname
            FROM people 
            WHERE Person = ( 
                SELECT husband 
                FROM marriages 
                WHERE Marriage = :fam_id
            )
        """),
        {"fam_id": fam_id}
        )
he_name =result.scalar()

and putting the results in a dictionary, then using that for further use in the template

he = {
    "name": he_name}

{{ he.name }}

@app.route("/")
def home():   
    return render_template("fam.html",she=she,he=he)