0

I query an existing table with the following code:

class Minicomputer(Base):
    __table__ = Base.metadata.tables[' minicomputer']

    def __repr__(self):
        return '<Masterlist %r>' % self.Hostname

Minicomputer.query.filter_by(name='CJ_1').first() returns the result, now I want to query via an existing view named mast_list. How do I do it?

Amin Alaee
  • 1,895
  • 17
  • 26
Flasking
  • 101
  • 2
  • 11

1 Answers1

0

Do you mean to pass the name as an argument to the view and query?

Like this:

@app.route('/master/<string:name>')
def mast_list(name):
 return Minicomputer.query.filter_by(name=name).first()
Nidhin Bose J.
  • 1,092
  • 15
  • 28