万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

Python SQLAlchemyの実行

        r = users.select(users.c.id == 1).execute().first()

の結果。

Error
Traceback (most recent call last):
  File "/Users/sugita/flask_app/socket_unity/database_test.py", line 35, in test_empty_db
    r = users.select(users.c.id == 1).execute().first()
  File "/Users/sugita/.virtualenvs/flask/lib/python2.7/site-packages/sqlalchemy/sql/base.py", line 373, in execute
    raise exc.UnboundExecutionError(msg)
UnboundExecutionError: This Select object is not directly bound to a Connection or Engine.Use the .execute() method of a Connection or Engine to execute this construct.


Process finished with exit code 0

Connectionのexecuteを使うべき?

        r = con.execute(users.select(users.c.id == 1)).first()

ならOKだった。