Hi,
I need some help, i am using Django as my web framework and sqlalchemy to 
query my database. When i pass data to template its not showing on the 
template. can someone point me to the right direction.

The post date is loaded on the template but the Net Balance sum is not 
loaded. Don't know what i am doing wrong here.

below is my view.py and template


view.py


def SUMCORP(request):
    engine=create_engine('mssql+pymssql://username:pass@servername 
/RBVData')
    connection=engine.connect()
    metadata=MetaData()
    fund=Table('gltrxdet',metadata,autoload=True,autoload_with=engine)
    
stmt=select([fund.columns.date_posted,func.sum(fund.columns.nat_balance)])
    stmt = stmt.where(fund.columns.account_code=='002CORP')
    stmt=stmt.group_by(fund.columns.date_posted)
    results=connection.execute(stmt).fetchall()
    return render_to_response('fundmanager_sum.html',locals())


template.html

<table class="table table-striped">
  <thead>
<tr>
  
  <th>Net Balance</th>
  <th>Post Date</th>
</thead>

</tr>
{%for a in results%}

<tr>

<td>{{a.nat_balance}}</td>
    <td>{{a.date_posted}}</td>

  </tr>

{%endfor%}
</table>



Cheers,

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to