Exemplo n.º 1
0
def start():
    session = Session(engine)
    start_info = session.query(station.id,
                        station.station,
                        func.min(Measurement.tobs),
                        func.max(Measurement.tobs),
                        func.avg(Measurement.tobs),
                        filter(Measurement.station) == Station.station).\
                        filer(Measurement.date>=start).all()
        )
def combined_start_stats(start):
    q = session.query(Station.id, Station.station, func.min(Measurement.tobs),
                      func.max(Measurement.tobs),
                      func.avg(Measurement.tobs)).filter(
                          Measurement.station == Station.station).filter(
                              Measurement.date >= start).all()
    print()
    print("Query Temps Combinded Stations with Start ({start}) Date")
    for row in q:
        print()
        print(row)
    return jsonify(q)
def station_start_end_stats(start, end):
    q = session.query(
        Station.id, Station.station, func.min(Measurement.tobs),
        func.max(Measurement.tobs), func.avg(Measurement.tobs)).filter(
            Measurement.station == Station.station).filter(
                Measurement.date <= end).filter(
                    Measurement.date >= start).group_by(
                        Station.station).order_by(Station.id).all()
    print()
    print(
        f"Query Temps for Stations with Start ({start}) and End ({end}) Date")
    for row in q:
        print()
        print(row)
    return jsonify(q)