3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Python3 + mysql-connector-pythonで実行したSQLを知りたい時

Last updated at Posted at 2019-12-05

あれ?なんで出力結果が期待値通りじゃないんだ?ってときにSQLを確認したいときはよくありますが、Python入門したばかりでやり方がわかりませんでした。Google先生に質問してみるも、意外と探すのに苦労したので備忘のためまとめておきます。

バージョン

Python:3.7.3
mysql-connector-python:8.0.18

本題

cur.execute("select * from tables where id = (%s)", (id,))
print(cur._executed)

これでOK。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?