3
votes

I have Model:

from flask.ext.sqlalchemy import SQLAlchemy 
db = SQLAlchemy()
class Graph(db.Model):
    __tablename__ = 'graph_view'
    group = Column(Unicode(250), primary_key=True)
    port_id1 = Column('portid1', Integer)
    port_id2 = Column('portid2', Integer)
    equipment_id1 = Column('equipmentid1', Integer)
    equipment_id2 = Column('equipmentid2', Integer)

where graph_view is database view. I am doing SELECT after connect:

    Graph.query.all()

and i'm getting nothing. Query is not wrong what can i do to fix this?

Check that your database actually has data? Are you using the return value of Graph.query.all()? What is your view code? - Martijn Pieters
I have a different Model(which is a table not a view) and it works fine. - kalombo
Also i get query from "print Graph.query" execute it and it works - kalombo
What I mean is that we are not psychic (however much SO answerers sometimes may seem to be). If your query is not wrong and there are no results returned, then your database is empty. - Martijn Pieters
Graph is not a table. Graph is a view('CREATE OR REPLACE VIEW graph_view AS SELECT...'). There is a key i guess. Should it work anyway? - kalombo