{"id":958474,"date":"2024-12-27T03:28:38","date_gmt":"2024-12-26T19:28:38","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/958474.html"},"modified":"2024-12-27T03:28:41","modified_gmt":"2024-12-26T19:28:41","slug":"python%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0mysql%e4%ba%a4%e4%ba%92","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/958474.html","title":{"rendered":"python\u5982\u4f55\u5b9e\u73b0mysql\u4ea4\u4e92"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25101523\/011097d1-5216-454d-9735-4e58ac9d186f.webp\" alt=\"python\u5982\u4f55\u5b9e\u73b0mysql\u4ea4\u4e92\" \/><\/p>\n<p><p> <strong>Python\u5b9e\u73b0MySQL\u4ea4\u4e92\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528MySQL Connector\u5e93\u3001\u4f7f\u7528SQLAlchemy ORM\u3001\u4f7f\u7528PyMySQL\u5e93\u3002<\/strong>MySQL Connector\u5e93\u662f\u5b98\u65b9\u63d0\u4f9b\u7684\u9a71\u52a8\u7a0b\u5e8f\uff0c\u6613\u4e8e\u4f7f\u7528\u4e14\u529f\u80fd\u5168\u9762\u3002SQLAlchemy\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f3a\u5927\u7684ORM\u5de5\u5177\uff0c\u53ef\u4ee5\u7b80\u5316\u6570\u636e\u5e93\u64cd\u4f5c\u3002PyMySQL\u662f\u4e00\u4e2a\u7eafPython\u7f16\u5199\u7684MySQL\u5ba2\u6237\u7aef\uff0c\u9002\u5408\u90a3\u4e9b\u4e0d\u5e0c\u671b\u4f9d\u8d56C\u6269\u5c55\u7684\u7528\u6237\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e09\u79cd\u65b9\u6cd5\u4e0eMySQL\u6570\u636e\u5e93\u8fdb\u884c\u4ea4\u4e92\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528MYSQL CONNECTOR\u5e93<\/p>\n<\/p>\n<p><p>MySQL Connector\u662f\u7531MySQL\u5b98\u65b9\u63d0\u4f9b\u7684Python\u9a71\u52a8\u7a0b\u5e8f\uff0c\u652f\u6301\u4e0eMySQL\u6570\u636e\u5e93\u8fdb\u884c\u4ea4\u4e92\u3002\u5b83\u5177\u6709\u826f\u597d\u7684\u517c\u5bb9\u6027\u548c\u6027\u80fd\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5MySQL Connector<\/strong><\/li>\n<\/ol>\n<p><p>\u8981\u4f7f\u7528MySQL Connector\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5b83\u3002\u53ef\u4ee5\u901a\u8fc7pip\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install mysql-connector-python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u8fde\u63a5\u6570\u636e\u5e93<\/strong><\/li>\n<\/ol>\n<p><p>\u8fde\u63a5\u6570\u636e\u5e93\u662f\u8fdb\u884c\u4efb\u4f55\u6570\u636e\u5e93\u64cd\u4f5c\u7684\u7b2c\u4e00\u6b65\u3002\u4f7f\u7528MySQL Connector\u8fde\u63a5\u6570\u636e\u5e93\u76f8\u5bf9\u7b80\u5355\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import mysql.connector<\/p>\n<p>conn = mysql.connector.connect(<\/p>\n<p>    host=&#39;localhost&#39;,<\/p>\n<p>    user=&#39;yourusername&#39;,<\/p>\n<p>    password=&#39;yourpassword&#39;,<\/p>\n<p>    database=&#39;yourdatabase&#39;<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c<code>host<\/code>\u662f\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\uff0c<code>user<\/code>\u548c<code>password<\/code>\u662f\u6570\u636e\u5e93\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c<code>database<\/code>\u662f\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li><strong>\u6267\u884cSQL\u8bed\u53e5<\/strong><\/li>\n<\/ol>\n<p><p>\u8fde\u63a5\u6210\u529f\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u6e38\u6807\u5bf9\u8c61\u6267\u884cSQL\u8bed\u53e5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">cursor = conn.cursor()<\/p>\n<h2><strong>\u6267\u884c\u67e5\u8be2\u8bed\u53e5<\/strong><\/h2>\n<p>cursor.execute(&quot;SELECT * FROM yourtable&quot;)<\/p>\n<h2><strong>\u83b7\u53d6\u67e5\u8be2\u7ed3\u679c<\/strong><\/h2>\n<p>result = cursor.fetchall()<\/p>\n<p>for row in result:<\/p>\n<p>    print(row)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"4\">\n<li><strong>\u63d2\u5165\u3001\u66f4\u65b0\u548c\u5220\u9664\u6570\u636e<\/strong><\/li>\n<\/ol>\n<p><p>\u9664\u4e86\u67e5\u8be2\u6570\u636e\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528MySQL Connector\u63d2\u5165\u3001\u66f4\u65b0\u548c\u5220\u9664\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u63d2\u5165\u6570\u636e<\/p>\n<p>cursor.execute(&quot;INSERT INTO yourtable (column1, column2) VALUES (%s, %s)&quot;, (value1, value2))<\/p>\n<p>conn.commit()<\/p>\n<h2><strong>\u66f4\u65b0\u6570\u636e<\/strong><\/h2>\n<p>cursor.execute(&quot;UPDATE yourtable SET column1 = %s WHERE column2 = %s&quot;, (new_value, condition))<\/p>\n<p>conn.commit()<\/p>\n<h2><strong>\u5220\u9664\u6570\u636e<\/strong><\/h2>\n<p>cursor.execute(&quot;DELETE FROM yourtable WHERE column1 = %s&quot;, (condition,))<\/p>\n<p>conn.commit()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"5\">\n<li><strong>\u5173\u95ed\u8fde\u63a5<\/strong><\/li>\n<\/ol>\n<p><p>\u5b8c\u6210\u6240\u6709\u64cd\u4f5c\u540e\uff0c\u4e0d\u8981\u5fd8\u8bb0\u5173\u95ed\u8fde\u63a5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">cursor.close()<\/p>\n<p>conn.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528SQLALCHEMY ORM<\/p>\n<\/p>\n<p><p>SQLAlchemy\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684Python\u5e93\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u9ad8\u7ea7\u7684ORM\u5de5\u5177\uff0c\u4f7f\u5f97\u4e0e\u6570\u636e\u5e93\u7684\u4ea4\u4e92\u66f4\u52a0\u65b9\u4fbf\u548c\u9ad8\u6548\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5SQLAlchemy<\/strong><\/li>\n<\/ol>\n<p><p>\u9996\u5148\uff0c\u9700\u8981\u5b89\u88c5SQLAlchemy\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install sqlalchemy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5<\/strong><\/li>\n<\/ol>\n<p><p>\u4f7f\u7528SQLAlchemy\u8fde\u63a5\u6570\u636e\u5e93\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u6570\u636e\u5e93\u5f15\u64ce\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sqlalchemy import create_engine<\/p>\n<p>engine = create_engine(&#39;mysql+mysqlconnector:\/\/yourusername:yourpassword@localhost\/yourdatabase&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li><strong>\u5b9a\u4e49ORM\u6a21\u578b<\/strong><\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u5b9a\u4e49\u7c7b\u6765\u6620\u5c04\u6570\u636e\u5e93\u8868\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sqlalchemy.ext.declarative import declarative_base<\/p>\n<p>from sqlalchemy import Column, Integer, String<\/p>\n<p>Base = declarative_base()<\/p>\n<p>class YourTable(Base):<\/p>\n<p>    __tablename__ = &#39;yourtable&#39;<\/p>\n<p>    id = Column(Integer, primary_key=True)<\/p>\n<p>    column1 = Column(String)<\/p>\n<p>    column2 = Column(String)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"4\">\n<li><strong>\u521b\u5efa\u4f1a\u8bdd\u5e76\u64cd\u4f5c\u6570\u636e<\/strong><\/li>\n<\/ol>\n<p><p>\u4f7f\u7528\u4f1a\u8bdd\u5bf9\u8c61\u8fdb\u884c\u6570\u636e\u5e93\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sqlalchemy.orm import sessionmaker<\/p>\n<p>Session = sessionmaker(bind=engine)<\/p>\n<p>session = Session()<\/p>\n<h2><strong>\u67e5\u8be2\u6570\u636e<\/strong><\/h2>\n<p>for instance in session.query(YourTable).order_by(YourTable.id):<\/p>\n<p>    print(instance.column1, instance.column2)<\/p>\n<h2><strong>\u63d2\u5165\u6570\u636e<\/strong><\/h2>\n<p>new_data = YourTable(column1=&#39;value1&#39;, column2=&#39;value2&#39;)<\/p>\n<p>session.add(new_data)<\/p>\n<p>session.commit()<\/p>\n<h2><strong>\u66f4\u65b0\u6570\u636e<\/strong><\/h2>\n<p>data_to_update = session.query(YourTable).filter_by(id=1).first()<\/p>\n<p>data_to_update.column1 = &#39;new_value&#39;<\/p>\n<p>session.commit()<\/p>\n<h2><strong>\u5220\u9664\u6570\u636e<\/strong><\/h2>\n<p>data_to_delete = session.query(YourTable).filter_by(id=2).first()<\/p>\n<p>session.delete(data_to_delete)<\/p>\n<p>session.commit()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"5\">\n<li><strong>\u5173\u95ed\u4f1a\u8bdd<\/strong><\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">session.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528PYMYSQL\u5e93<\/p>\n<\/p>\n<p><p>PyMySQL\u662f\u4e00\u4e2a\u7eafPython\u7f16\u5199\u7684MySQL\u5ba2\u6237\u7aef\uff0c\u9002\u7528\u4e8e\u4e0d\u5e0c\u671b\u4f9d\u8d56C\u6269\u5c55\u7684\u7528\u6237\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5b89\u88c5PyMySQL<\/strong><\/li>\n<\/ol>\n<p><p>\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5PyMySQL\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pymysql<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u8fde\u63a5\u6570\u636e\u5e93<\/strong><\/li>\n<\/ol>\n<p><p>\u4f7f\u7528PyMySQL\u8fde\u63a5\u6570\u636e\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pymysql<\/p>\n<p>conn = pymysql.connect(<\/p>\n<p>    host=&#39;localhost&#39;,<\/p>\n<p>    user=&#39;yourusername&#39;,<\/p>\n<p>    password=&#39;yourpassword&#39;,<\/p>\n<p>    database=&#39;yourdatabase&#39;<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li><strong>\u6267\u884cSQL\u8bed\u53e5<\/strong><\/li>\n<\/ol>\n<p><p>\u83b7\u53d6\u6e38\u6807\u5e76\u6267\u884cSQL\u8bed\u53e5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">cursor = conn.cursor()<\/p>\n<h2><strong>\u67e5\u8be2\u6570\u636e<\/strong><\/h2>\n<p>cursor.execute(&quot;SELECT * FROM yourtable&quot;)<\/p>\n<p>result = cursor.fetchall()<\/p>\n<p>for row in result:<\/p>\n<p>    print(row)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"4\">\n<li><strong>\u63d2\u5165\u3001\u66f4\u65b0\u548c\u5220\u9664\u6570\u636e<\/strong><\/li>\n<\/ol>\n<p><pre><code class=\"language-python\"># \u63d2\u5165\u6570\u636e<\/p>\n<p>cursor.execute(&quot;INSERT INTO yourtable (column1, column2) VALUES (%s, %s)&quot;, (value1, value2))<\/p>\n<p>conn.commit()<\/p>\n<h2><strong>\u66f4\u65b0\u6570\u636e<\/strong><\/h2>\n<p>cursor.execute(&quot;UPDATE yourtable SET column1 = %s WHERE column2 = %s&quot;, (new_value, condition))<\/p>\n<p>conn.commit()<\/p>\n<h2><strong>\u5220\u9664\u6570\u636e<\/strong><\/h2>\n<p>cursor.execute(&quot;DELETE FROM yourtable WHERE column1 = %s&quot;, (condition,))<\/p>\n<p>conn.commit()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"5\">\n<li><strong>\u5173\u95ed\u8fde\u63a5<\/strong><\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">cursor.close()<\/p>\n<p>conn.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u56db\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u4e0eMySQL\u6570\u636e\u5e93\u8fdb\u884c\u4ea4\u4e92\uff0c\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u4f18\u7f3a\u70b9\u3002<strong>MySQL Connector\u5e93<\/strong>\u662f\u5b98\u65b9\u63d0\u4f9b\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u529f\u80fd\u5168\u9762\u4e14\u6613\u4e8e\u4f7f\u7528\uff0c\u9002\u5408\u5927\u591a\u6570\u5e94\u7528\u573a\u666f\u3002<strong>SQLAlchemy<\/strong>\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f3a\u5927\u7684ORM\uff0c\u53ef\u4ee5\u7b80\u5316\u590d\u6742\u7684\u6570\u636e\u5e93\u64cd\u4f5c\uff0c\u9002\u5408\u5bf9\u6570\u636e\u6a21\u578b\u6709\u66f4\u9ad8\u62bd\u8c61\u9700\u6c42\u7684\u573a\u666f\u3002<strong>PyMySQL<\/strong>\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u9002\u5408\u4e0d\u5e0c\u671b\u4f9d\u8d56C\u6269\u5c55\u7684\u7528\u6237\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u6700\u5408\u9002\u7684\u65b9\u6cd5\u3002\u65e0\u8bba\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\uff0c\u90fd\u9700\u8981\u786e\u4fdd\u6570\u636e\u5e93\u8fde\u63a5\u7684\u5b89\u5168\u6027\uff0c\u5c24\u5176\u662f\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u9632\u6b62SQL\u6ce8\u5165\u548c\u6570\u636e\u6cc4\u9732\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u8fde\u63a5MySQL\u6570\u636e\u5e93\uff1f<\/strong><br \/>\u8981\u5728Python\u4e2d\u8fde\u63a5MySQL\u6570\u636e\u5e93\uff0c\u60a8\u9700\u8981\u4f7f\u7528MySQL Connector\u6216\u5176\u4ed6\u76f8\u5173\u5e93\uff0c\u5982PyMySQL\u6216SQLAlchemy\u3002\u5b89\u88c5\u5e93\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u8fde\u63a5\u6570\u636e\u5e93\uff1a  <\/p>\n<pre><code class=\"language-python\">import mysql.connector\n\nconn = mysql.connector.connect(\n    host=&#39;localhost&#39;,\n    user=&#39;your_username&#39;,\n    password=&#39;your_password&#39;,\n    database=&#39;your_database&#39;\n)\n\nif conn.is_connected():\n    print(&quot;\u6210\u529f\u8fde\u63a5\u5230\u6570\u636e\u5e93&quot;)\n<\/code><\/pre>\n<p>\u786e\u4fdd\u66ff\u6362\u6389<code>your_username<\/code>\u3001<code>your_password<\/code>\u548c<code>your_database<\/code>\u4e3a\u60a8\u7684\u5b9e\u9645\u6570\u636e\u5e93\u4fe1\u606f\u3002<\/p>\n<p><strong>Python\u4e0eMySQL\u4ea4\u4e92\u65f6\u5982\u4f55\u6267\u884cCRUD\u64cd\u4f5c\uff1f<\/strong><br \/>\u5728Python\u4e2d\u6267\u884cCRUD\uff08\u521b\u5efa\u3001\u8bfb\u53d6\u3001\u66f4\u65b0\u3001\u5220\u9664\uff09\u64cd\u4f5c\u53ef\u4ee5\u901a\u8fc7\u6e38\u6807\u5bf9\u8c61\u5b9e\u73b0\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a  <\/p>\n<ul>\n<li>\u521b\u5efa\uff1a\u4f7f\u7528INSERT\u8bed\u53e5\u5411\u6570\u636e\u5e93\u4e2d\u63d2\u5165\u8bb0\u5f55\u3002  <\/li>\n<li>\u8bfb\u53d6\uff1a\u4f7f\u7528SELECT\u8bed\u53e5\u4ece\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u6570\u636e\u3002  <\/li>\n<li>\u66f4\u65b0\uff1a\u4f7f\u7528UPDATE\u8bed\u53e5\u4fee\u6539\u5df2\u6709\u8bb0\u5f55\u3002  <\/li>\n<li>\u5220\u9664\uff1a\u4f7f\u7528DELETE\u8bed\u53e5\u79fb\u9664\u8bb0\u5f55\u3002<br \/>\u4ee3\u7801\u793a\u4f8b\uff1a<\/li>\n<\/ul>\n<pre><code class=\"language-python\">cursor = conn.cursor()\n\n# \u521b\u5efa\ncursor.execute(&quot;INSERT INTO your_table (column1, column2) VALUES (value1, value2)&quot;)\n\n# \u8bfb\u53d6\ncursor.execute(&quot;SELECT * FROM your_table&quot;)\nresults = cursor.fetchall()\n\n# \u66f4\u65b0\ncursor.execute(&quot;UPDATE your_table SET column1 = value1 WHERE condition&quot;)\n\n# \u5220\u9664\ncursor.execute(&quot;DELETE FROM your_table WHERE condition&quot;)\n\nconn.commit()  # \u63d0\u4ea4\u66f4\u6539\ncursor.close()\n<\/code><\/pre>\n<p><strong>\u5728Python\u4e2d\u5982\u4f55\u5904\u7406MySQL\u5f02\u5e38\u548c\u9519\u8bef\uff1f<\/strong><br \/>\u5728\u8fdb\u884c\u6570\u636e\u5e93\u64cd\u4f5c\u65f6\uff0c\u5904\u7406\u5f02\u5e38\u975e\u5e38\u91cd\u8981\u3002\u53ef\u4ee5\u4f7f\u7528try-except\u8bed\u53e5\u6355\u6349\u9519\u8bef\u5e76\u8fdb\u884c\u5904\u7406\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a  <\/p>\n<pre><code class=\"language-python\">try:\n    # \u6570\u636e\u5e93\u64cd\u4f5c\u4ee3\u7801\n    cursor.execute(&quot;SELECT * FROM your_table&quot;)\nexcept mysql.connector.Error as err:\n    print(f&quot;\u6570\u636e\u5e93\u9519\u8bef: {err}&quot;)\nexcept Exception as e:\n    print(f&quot;\u53d1\u751f\u4e86\u4e00\u4e2a\u9519\u8bef: {e}&quot;)\nfinally:\n    cursor.close()\n    conn.close()\n<\/code><\/pre>\n<p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u5728\u53d1\u751f\u9519\u8bef\u65f6\u4e0d\u4f1a\u4e2d\u65ad\uff0c\u5e76\u80fd\u591f\u8fdb\u884c\u9002\u5f53\u7684\u9519\u8bef\u5904\u7406\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5b9e\u73b0MySQL\u4ea4\u4e92\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528MySQL Connector\u5e93\u3001\u4f7f\u7528SQLAlchemy OR [&hellip;]","protected":false},"author":3,"featured_media":958481,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/958474"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=958474"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/958474\/revisions"}],"predecessor-version":[{"id":958482,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/958474\/revisions\/958482"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/958481"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=958474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=958474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=958474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}