{"action":"created","issue":{"url":"https://api.github.com/repos/dengdaiyemanren/python/issues/6","repository_url":"https://api.github.com/repos/dengdaiyemanren/python","labels_url":"https://api.github.com/repos/dengdaiyemanren/python/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/dengdaiyemanren/python/issues/6/comments","events_url":"https://api.github.com/repos/dengdaiyemanren/python/issues/6/events","html_url":"https://github.com/dengdaiyemanren/python/issues/6","id":174936190,"number":6,"title":"python orm 之SQLALchemy使用","user":{"login":"dengdaiyemanren","id":11519868,"avatar_url":"https://avatars.githubusercontent.com/u/11519868?v=3","gravatar_id":"","url":"https://api.github.com/users/dengdaiyemanren","html_url":"https://github.com/dengdaiyemanren","followers_url":"https://api.github.com/users/dengdaiyemanren/followers","following_url":"https://api.github.com/users/dengdaiyemanren/following{/other_user}","gists_url":"https://api.github.com/users/dengdaiyemanren/gists{/gist_id}","starred_url":"https://api.github.com/users/dengdaiyemanren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dengdaiyemanren/subscriptions","organizations_url":"https://api.github.com/users/dengdaiyemanren/orgs","repos_url":"https://api.github.com/users/dengdaiyemanren/repos","events_url":"https://api.github.com/users/dengdaiyemanren/events{/privacy}","received_events_url":"https://api.github.com/users/dengdaiyemanren/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-04T07:38:03Z","updated_at":"2016-09-04T14:02:35Z","closed_at":null,"body":"http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/0014021031294178f993c85204e4d1b81ab032070641ce5000"},"comment":{"url":"https://api.github.com/repos/dengdaiyemanren/python/issues/comments/244605176","html_url":"https://github.com/dengdaiyemanren/python/issues/6#issuecomment-244605176","issue_url":"https://api.github.com/repos/dengdaiyemanren/python/issues/6","id":244605176,"user":{"login":"dengdaiyemanren","id":11519868,"avatar_url":"https://avatars.githubusercontent.com/u/11519868?v=3","gravatar_id":"","url":"https://api.github.com/users/dengdaiyemanren","html_url":"https://github.com/dengdaiyemanren","followers_url":"https://api.github.com/users/dengdaiyemanren/followers","following_url":"https://api.github.com/users/dengdaiyemanren/following{/other_user}","gists_url":"https://api.github.com/users/dengdaiyemanren/gists{/gist_id}","starred_url":"https://api.github.com/users/dengdaiyemanren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dengdaiyemanren/subscriptions","organizations_url":"https://api.github.com/users/dengdaiyemanren/orgs","repos_url":"https://api.github.com/users/dengdaiyemanren/repos","events_url":"https://api.github.com/users/dengdaiyemanren/events{/privacy}","received_events_url":"https://api.github.com/users/dengdaiyemanren/received_events","type":"User","site_admin":false},"created_at":"2016-09-04T14:02:35Z","updated_at":"2016-09-04T14:02:35Z","body":"查询：\r\n````python\r\nfrom sqlalchemy.orm import sessionmaker\r\nfrom sqlalchemy.ext.declarative import declarative_base\r\nfrom sqlalchemy import Column, Integer, String\r\nfrom sqlalchemy import create_engine\r\n\r\nBase = declarative_base()\r\n\r\nclass WpOptions(Base):\r\n    __tablename__ = 'wp_options'\r\n    option_name = Column(String(50),primary_key=True)\r\n    option_value = Column(String(512))\r\n\r\n\r\nif __name__ == '__main__':\r\n    engine = create_engine('mysql://root:a769dcc1da@120.26.103.166/test?charset=utf8')\r\n    Session = sessionmaker(bind=engine)\r\n    session = Session()\r\n    \r\n    ##query\r\n    for instance in session.query(WpOptions).filter(WpOptions.option_name == 'html_type').order_by(WpOptions.option_name):\r\n        print instance.option_value\r\n````        "}}
{"actor":{"display_login":"dengdaiyemanren"}}