{"action":"opened","issue":{"url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/451","repository_url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy","labels_url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/451/labels{/name}","comments_url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/451/comments","events_url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/451/events","html_url":"https://github.com/mitsuhiko/flask-sqlalchemy/issues/451","id":194956871,"number":451,"title":"order_by descending ","user":{"login":"tuwid","id":7482795,"avatar_url":"https://avatars.githubusercontent.com/u/7482795?v=3","gravatar_id":"","url":"https://api.github.com/users/tuwid","html_url":"https://github.com/tuwid","followers_url":"https://api.github.com/users/tuwid/followers","following_url":"https://api.github.com/users/tuwid/following{/other_user}","gists_url":"https://api.github.com/users/tuwid/gists{/gist_id}","starred_url":"https://api.github.com/users/tuwid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuwid/subscriptions","organizations_url":"https://api.github.com/users/tuwid/orgs","repos_url":"https://api.github.com/users/tuwid/repos","events_url":"https://api.github.com/users/tuwid/events{/privacy}","received_events_url":"https://api.github.com/users/tuwid/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-12T11:58:07Z","updated_at":"2016-12-12T11:58:07Z","closed_at":null,"body":"Hello,\r\nI have the following model\r\n```\r\nclass Server(db.Model):\r\n    serverId = db.Column(db.Integer, primary_key=True)\r\n    serverName = db.Column(db.String(20))\r\n    serverIP = db.Column(db.String(20))\r\n    serverNote = db.Column(db.String(200))\r\n    serverStatus = db.Column(db.String(10))\r\n    serverBlNr = db.Column(db.Integer)\r\n    lastChecked = db.Column(db.DateTime(), default=datetime.utcnow, onupdate=datetime.utcnow)\r\n\r\n    def __init__(self, Name, IP, Note, Status):\r\n        self.serverName = Name\r\n        self.serverIP = IP\r\n        self.serverNote = Note\r\n        self.serverStatus = Status\r\n        self.serverBlNr = BlackNumber\r\n```\r\nAnd I've written the following route:\r\n```\r\n@app.route('/api/servers/', methods=['GET'])\r\ndef api_get_servers():\r\n server_list = Server.query.order_by(Server.lastChecked).limit(10)\r\n data = {}\r\n for srv in server_list:\r\n     data[srv.serverId] = {\r\n             'serverName' : srv.serverName,\r\n             'serverIP' : srv.serverIP,\r\n             'serverStatus' : srv.serverStatus,\r\n             'serverNote' : srv.serverNote,\r\n             'lastChecked' : srv.lastChecked\r\n     }\r\n return jsonify({'servers': data})\r\n\r\n```\r\nIs this the correct way to get the olderst 10 results ? \r\n```\r\n server_list = Server.query.order_by(Server.lastChecked).limit(10)\r\n```\r\n"}}
{"actor":{"display_login":"tuwid"}}