Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug TiDB Documentation: 使用 PyMySQL 连接到 TiDB #15937

Closed
Tracked by #15772
qiancai opened this issue Dec 29, 2023 · 7 comments · Fixed by #16160
Closed
Tracked by #15772

Debug TiDB Documentation: 使用 PyMySQL 连接到 TiDB #15937

qiancai opened this issue Dec 29, 2023 · 7 comments · Fixed by #16160
Assignees
Labels
2024-tidb-docs-dash This issue or PR is included in the 2024 TiDB Docs Dash event.

Comments

@qiancai
Copy link
Collaborator

qiancai commented Dec 29, 2023

此 issue 为 Debug TiDB Documentation: TiDB 中文文档测试说明・Issue #15772・pingcap/docs-cn 的 sub-issue,目的是为了测试和验证使用 PyMySQL 连接到 TiDB 文档。

请参考 #15772 中的说明测试该文档。

  1. 在完成文档验证后,将您的验证结果以评论的形式添加到当前 issue 上。验证结果可以是您遇到的问题、发现的错误或其他任何发现。如果验证顺利通过,您也可以添加评论说明。
  2. 对于在验证过程中发现的任何问题或错误,欢迎创建 Pull Request(PR)直接修正文档。创建 PR 时,请在 PR 描述中指明该 PR 解决了哪个 issue (例如,Fix #15937)。关于如何创建 PR 的详情,请参考TiDB 中文文档贡献指南

非常感谢您对测试和验证文档的贡献!

@jyf111
Copy link
Contributor

jyf111 commented Jan 1, 2024

/assign

@jyf111
Copy link
Contributor

jyf111 commented Jan 6, 2024

The doc has been verified with WSL2, python3.10 and TiDB Serverless, the output is consistent.

$ python pymysql_example.py
{'id': 'test', 'coins': 1, 'goods': 1}
number of players: 1920
{'id': 'test', 'coins': 1, 'goods': 1}
{'id': 'test0', 'coins': 10000, 'goods': 10000}
{'id': 'test1', 'coins': 10000, 'goods': 10000}
buy player 1 coins not enough
trade success
{'id': '1', 'coins': 0, 'goods': 2}
{'id': '2', 'coins': 114614, 'goods': 18}

@qiancai
Copy link
Collaborator Author

qiancai commented Jan 7, 2024

@jyf111 Appreciate your time and effort for this task. To get the points of this issue, would you please resubmit the result as a comment during the event dates/time as follows?

  • Beijing Time: January 9 at 16:00 – January 12 at 16:00
  • Global Time: January 9 at 08:00 UTC (your local time) – January 12 at 07:59 UTC (your local time)

@rpaik
Copy link
Member

rpaik commented Jan 10, 2024

@jyf111 thanks for your contributions. Just a friendly reminder to resubmit your comment by January 12 at 07:59 UTC (your local time) 🙏

@jyf111
Copy link
Contributor

jyf111 commented Jan 10, 2024

The doc has been verified with WSL2, python3.10 and TiDB Serverless, the output is consistent.

$ python pymysql_example.py
{'id': 'test', 'coins': 1, 'goods': 1}
number of players: 1920
{'id': 'test', 'coins': 1, 'goods': 1}
{'id': 'test0', 'coins': 10000, 'goods': 10000}
{'id': 'test1', 'coins': 10000, 'goods': 10000}
buy player 1 coins not enough
trade success
{'id': '1', 'coins': 0, 'goods': 2}
{'id': '2', 'coins': 114614, 'goods': 18}

The doc is generally okay, with some minor issues. e.g., in the example code:

with get_connection(autocommit=True) as conn:
    with conn.cursor() as cur:
        player = ("1", 1, 1)
        **cursor**.execute("INSERT INTO players (id, coins, goods) VALUES (%s, %s, %s)", player)

cursor should be cur. And this code does not match the code in pymysql_example.py:

def create_player(cursor: DictCursor, player: tuple) -> None:
    cursor.execute("INSERT INTO players (id, coins, goods) VALUES (%s, %s, %s)", player)

@qiancai
Copy link
Collaborator Author

qiancai commented Jan 11, 2024

Hi @jyf111, many thanks for your contribution. If you're interested, feel free to create a pull request (PR) to update the documentation directly.

@qiancai
Copy link
Collaborator Author

qiancai commented Jan 31, 2024

@jyf111 非常感谢您对使用 PyMySQL 连接到 TiDB文档的测试❤️。因为测试后创建的文档修改 PR #16160 已合并,此 issue 已自动关闭。如果后续您再遇到任何文档问题,欢迎在此文档仓库提 issue 或者 PR 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2024-tidb-docs-dash This issue or PR is included in the 2024 TiDB Docs Dash event.
Development

Successfully merging a pull request may close this issue.

3 participants