{"id":1115701,"date":"2025-01-08T18:09:21","date_gmt":"2025-01-08T10:09:21","guid":{"rendered":""},"modified":"2025-01-08T18:09:24","modified_gmt":"2025-01-08T10:09:24","slug":"python%e5%a6%82%e4%bd%95%e6%89%a7%e8%a1%8c%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1115701.html","title":{"rendered":"python\u5982\u4f55\u6267\u884c\u6570\u636e\u5e93\u5907\u4efd"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25080337\/bac9ed33-cd26-40de-a4a0-6e5ad8b489ed.webp\" alt=\"python\u5982\u4f55\u6267\u884c\u6570\u636e\u5e93\u5907\u4efd\" \/><\/p>\n<p><p> <strong>Python\u6267\u884c\u6570\u636e\u5e93\u5907\u4efd\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528\u6570\u636e\u5e93\u7279\u5b9a\u7684\u5907\u4efd\u5de5\u5177\u3001\u76f4\u63a5\u6267\u884cSQL\u547d\u4ee4\u3001\u4ee5\u53ca\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u7b49\u3002\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\uff1a\u4f7f\u7528\u6570\u636e\u5e93\u5de5\u5177\uff08\u5982mysqldump\u3001pg_dump\uff09\u3001\u4f7f\u7528SQL\u547d\u4ee4\u5907\u4efd\u6570\u636e\u3001\u5229\u7528\u7b2c\u4e09\u65b9\u5e93\uff08\u5982SQLAlchemy\u3001Django ORM\uff09\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528\u6570\u636e\u5e93\u7279\u5b9a\u7684\u5907\u4efd\u5de5\u5177\u8fdb\u884c\u5907\u4efd\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u8981\u8be6\u7ec6\u63cf\u8ff0\u4e00\u79cd\u65b9\u6cd5\uff0c\u672c\u6587\u5c06\u4ee5MySQL\u6570\u636e\u5e93\u4e3a\u4f8b\uff0c\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Python\u6267\u884c\u6570\u636e\u5e93\u5907\u4efd\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528mysqldump\u8fdb\u884cMySQL\u6570\u636e\u5e93\u5907\u4efd<\/h2>\n<\/p>\n<p><h3>1\u3001\u5b89\u88c5mysqldump<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528mysqldump\u5de5\u5177\u8fdb\u884c\u5907\u4efd\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u5728\u7cfb\u7edf\u4e2d\u5df2\u7ecf\u5b89\u88c5\u4e86mysqldump\u5de5\u5177\u3002mysqldump\u662fMySQL\u81ea\u5e26\u7684\u4e00\u4e2a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u901a\u5e38\u5728\u5b89\u88c5MySQL\u65f6\u4f1a\u81ea\u52a8\u5b89\u88c5\u3002\u5982\u679c\u672a\u5b89\u88c5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5728Linux\u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5\uff1a\n<pre><code class=\"language-bash\">sudo apt-get install mysql-client<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7MySQL\u5b98\u7f51\u4e0b\u8f7d\u5b89\u88c5MySQL\u5ba2\u6237\u7aef\u5de5\u5177\u5305\u3002<\/li>\n<\/ul>\n<p><h3>2\u3001\u7f16\u5199Python\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528Python\u7684subprocess\u6a21\u5757\u53ef\u4ee5\u65b9\u4fbf\u5730\u8c03\u7528\u7cfb\u7edf\u547d\u4ee4\u6267\u884c\u5907\u4efd\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import subprocess<\/p>\n<p>import datetime<\/p>\n<p>def backup_database(host, user, password, database, backup_dir):<\/p>\n<p>    # \u751f\u6210\u5907\u4efd\u6587\u4ef6\u540d<\/p>\n<p>    timestamp = datetime.datetime.now().strftime(&#39;%Y%m%d%H%M%S&#39;)<\/p>\n<p>    backup_file = f&quot;{backup_dir}\/{database}_{timestamp}.sql&quot;<\/p>\n<p>    # \u6784\u5efamysqldump\u547d\u4ee4<\/p>\n<p>    dump_cmd = [<\/p>\n<p>        &quot;mysqldump&quot;,<\/p>\n<p>        f&quot;--host={host}&quot;,<\/p>\n<p>        f&quot;--user={user}&quot;,<\/p>\n<p>        f&quot;--password={password}&quot;,<\/p>\n<p>        database<\/p>\n<p>    ]<\/p>\n<p>    # \u6267\u884c\u5907\u4efd\u547d\u4ee4<\/p>\n<p>    with open(backup_file, &#39;w&#39;) as f:<\/p>\n<p>        result = subprocess.run(dump_cmd, stdout=f, stderr=subprocess.PIPE)<\/p>\n<p>    if result.returncode == 0:<\/p>\n<p>        print(f&quot;Database backup successfully created at {backup_file}&quot;)<\/p>\n<p>    else:<\/p>\n<p>        print(f&quot;Error in creating database backup: {result.stderr}&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\u8c03\u7528<\/strong><\/h2>\n<p>backup_database(&quot;localhost&quot;, &quot;root&quot;, &quot;password&quot;, &quot;mydatabase&quot;, &quot;\/path\/to\/backup\/dir&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3\u3001\u89e3\u91ca\u811a\u672c<\/h3>\n<\/p>\n<ul>\n<li><strong>import subprocess<\/strong>\uff1a\u5bfc\u5165subprocess\u6a21\u5757\uff0c\u7528\u4e8e\u8c03\u7528\u5916\u90e8\u547d\u4ee4\u3002<\/li>\n<li><strong>import datetime<\/strong>\uff1a\u5bfc\u5165datetime\u6a21\u5757\uff0c\u7528\u4e8e\u751f\u6210\u5907\u4efd\u6587\u4ef6\u7684\u65f6\u95f4\u6233\u3002<\/li>\n<li><strong>backup_database\u51fd\u6570<\/strong>\uff1a\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u6765\u6267\u884c\u6570\u636e\u5e93\u5907\u4efd\u3002\n<ul>\n<li><strong>host\u3001user\u3001password\u3001database\u3001backup_dir<\/strong>\uff1a\u51fd\u6570\u53c2\u6570\uff0c\u7528\u4e8e\u6307\u5b9a\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u548c\u5907\u4efd\u76ee\u5f55\u3002<\/li>\n<li><strong>timestamp<\/strong>\uff1a\u751f\u6210\u5f53\u524d\u65f6\u95f4\u7684\u5b57\u7b26\u4e32\uff0c\u7528\u4e8e\u7ed9\u5907\u4efd\u6587\u4ef6\u547d\u540d\u3002<\/li>\n<li><strong>backup_file<\/strong>\uff1a\u6784\u5efa\u5907\u4efd\u6587\u4ef6\u7684\u5b8c\u6574\u8def\u5f84\u3002<\/li>\n<li><strong>dump_cmd<\/strong>\uff1a\u6784\u5efamysqldump\u547d\u4ee4\uff0c\u5305\u542b\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u548c\u6570\u636e\u5e93\u540d\u79f0\u3002<\/li>\n<li><strong>subprocess.run<\/strong>\uff1a\u6267\u884cmysqldump\u547d\u4ee4\uff0c\u5e76\u5c06\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u5907\u4efd\u6587\u4ef6\u4e2d\u3002<\/li>\n<li><strong>result.returncode<\/strong>\uff1a\u68c0\u67e5\u547d\u4ee4\u6267\u884c\u7ed3\u679c\uff0c\u8fd4\u56de0\u8868\u793a\u6210\u529f\uff0c\u975e0\u8868\u793a\u5931\u8d25\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><h3>4\u3001\u5b9a\u65f6\u5907\u4efd<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684\u5b9a\u65f6\u4efb\u52a1\u5de5\u5177\uff08\u5982Linux\u7684cron\u3001Windows\u7684Task Scheduler\uff09\u6765\u5b9a\u65f6\u6267\u884c\u5907\u4efd\u811a\u672c\u3002\u4f8b\u5982\uff0c\u5728Linux\u4e0a\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u8bbe\u7f6e\u6bcf\u5929\u51cc\u66682\u70b9\u6267\u884c\u5907\u4efd\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">crontab -e<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728crontab\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">0 2 * * * \/usr\/bin\/python3 \/path\/to\/backup_script.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e8c\u3001\u5176\u4ed6\u6570\u636e\u5e93\u7684\u5907\u4efd\u65b9\u6cd5<\/h2>\n<\/p>\n<p><h3>1\u3001\u4f7f\u7528pg_dump\u8fdb\u884cPostgreSQL\u6570\u636e\u5e93\u5907\u4efd<\/h3>\n<\/p>\n<p><p>pg_dump\u662fPostgreSQL\u81ea\u5e26\u7684\u5907\u4efd\u5de5\u5177\uff0c\u7c7b\u4f3c\u4e8eMySQL\u7684mysqldump\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528pg_dump\u8fdb\u884c\u5907\u4efd\u7684\u793a\u4f8b\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import subprocess<\/p>\n<p>import datetime<\/p>\n<p>def backup_postgresql_database(host, user, password, database, backup_dir):<\/p>\n<p>    # \u751f\u6210\u5907\u4efd\u6587\u4ef6\u540d<\/p>\n<p>    timestamp = datetime.datetime.now().strftime(&#39;%Y%m%d%H%M%S&#39;)<\/p>\n<p>    backup_file = f&quot;{backup_dir}\/{database}_{timestamp}.sql&quot;<\/p>\n<p>    # \u6784\u5efapg_dump\u547d\u4ee4<\/p>\n<p>    dump_cmd = [<\/p>\n<p>        &quot;pg_dump&quot;,<\/p>\n<p>        f&quot;--host={host}&quot;,<\/p>\n<p>        f&quot;--username={user}&quot;,<\/p>\n<p>        f&quot;--dbname={database}&quot;<\/p>\n<p>    ]<\/p>\n<p>    # \u8bbe\u7f6e\u73af\u5883\u53d8\u91cfPGPASSWORD<\/p>\n<p>    env = {&quot;PGPASSWORD&quot;: password}<\/p>\n<p>    # \u6267\u884c\u5907\u4efd\u547d\u4ee4<\/p>\n<p>    with open(backup_file, &#39;w&#39;) as f:<\/p>\n<p>        result = subprocess.run(dump_cmd, stdout=f, stderr=subprocess.PIPE, env=env)<\/p>\n<p>    if result.returncode == 0:<\/p>\n<p>        print(f&quot;Database backup successfully created at {backup_file}&quot;)<\/p>\n<p>    else:<\/p>\n<p>        print(f&quot;Error in creating database backup: {result.stderr}&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\u8c03\u7528<\/strong><\/h2>\n<p>backup_postgresql_database(&quot;localhost&quot;, &quot;postgres&quot;, &quot;password&quot;, &quot;mydatabase&quot;, &quot;\/path\/to\/backup\/dir&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2\u3001\u4f7f\u7528SQLAlchemy\u8fdb\u884c\u6570\u636e\u5e93\u5907\u4efd<\/h3>\n<\/p>\n<p><p>SQLAlchemy\u662f\u4e00\u4e2aPython\u7684ORM\u6846\u67b6\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u64cd\u4f5c\u5404\u79cd\u6570\u636e\u5e93\u3002\u4f7f\u7528SQLAlchemy\u8fdb\u884c\u5907\u4efd\u7684\u601d\u8def\u662f\u8bfb\u53d6\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\uff0c\u5e76\u5c06\u5176\u5bfc\u51fa\u5230\u6587\u4ef6\u4e2d\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sqlalchemy import create_engine<\/p>\n<p>import pandas as pd<\/p>\n<p>def backup_database_with_sqlalchemy(connection_string, backup_file):<\/p>\n<p>    # \u521b\u5efa\u6570\u636e\u5e93\u5f15\u64ce<\/p>\n<p>    engine = create_engine(connection_string)<\/p>\n<p>    # \u8bfb\u53d6\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868<\/p>\n<p>    with engine.connect() as conn:<\/p>\n<p>        tables = engine.table_names()<\/p>\n<p>    # \u5bfc\u51fa\u6bcf\u4e2a\u8868\u7684\u6570\u636e\u5230CSV\u6587\u4ef6<\/p>\n<p>    with pd.ExcelWriter(backup_file) as writer:<\/p>\n<p>        for table in tables:<\/p>\n<p>            df = pd.read_sql_table(table, engine)<\/p>\n<p>            df.to_excel(writer, sheet_name=table, index=False)<\/p>\n<p>    print(f&quot;Database backup successfully created at {backup_file}&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\u8c03\u7528<\/strong><\/h2>\n<p>connection_string = &quot;mysql+pymysql:\/\/user:password@localhost\/mydatabase&quot;<\/p>\n<p>backup_file = &quot;\/path\/to\/backup\/dir\/mydatabase_backup.xlsx&quot;<\/p>\n<p>backup_database_with_sqlalchemy(connection_string, backup_file)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3\u3001\u4f7f\u7528Django ORM\u8fdb\u884c\u6570\u636e\u5e93\u5907\u4efd<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4f7f\u7528Django\u5f00\u53d1\u9879\u76ee\uff0c\u53ef\u4ee5\u5229\u7528Django ORM\u8fdb\u884c\u6570\u636e\u5e93\u5907\u4efd\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>from django.core.management import call_command<\/p>\n<p>import datetime<\/p>\n<p>def backup_django_database(backup_dir):<\/p>\n<p>    # \u751f\u6210\u5907\u4efd\u6587\u4ef6\u540d<\/p>\n<p>    timestamp = datetime.datetime.now().strftime(&#39;%Y%m%d%H%M%S&#39;)<\/p>\n<p>    backup_file = os.path.join(backup_dir, f&quot;db_backup_{timestamp}.json&quot;)<\/p>\n<p>    # \u6267\u884c\u6570\u636e\u5e93\u5907\u4efd\u547d\u4ee4<\/p>\n<p>    with open(backup_file, &#39;w&#39;) as f:<\/p>\n<p>        call_command(&#39;dumpdata&#39;, stdout=f)<\/p>\n<p>    print(f&quot;Database backup successfully created at {backup_file}&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\u8c03\u7528<\/strong><\/h2>\n<p>backup_django_database(&quot;\/path\/to\/backup\/dir&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5c0f\u7ed3<\/h3>\n<\/p>\n<p><p>\u672c\u6587\u4ecb\u7ecd\u4e86\u591a\u79cd\u4f7f\u7528Python\u6267\u884c\u6570\u636e\u5e93\u5907\u4efd\u7684\u65b9\u6cd5\uff0c\u5305\u62ec\u4f7f\u7528\u6570\u636e\u5e93\u7279\u5b9a\u7684\u5907\u4efd\u5de5\u5177\uff08\u5982mysqldump\u3001pg_dump\uff09\u3001\u4f7f\u7528SQLAlchemy\u548cDjango ORM\u8fdb\u884c\u5907\u4efd\u3002\u8fd9\u4e9b\u65b9\u6cd5\u5404\u6709\u4f18\u7f3a\u70b9\uff0c\u5177\u4f53\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\u53d6\u51b3\u4e8e\u5b9e\u9645\u9700\u6c42\u548c\u9879\u76ee\u73af\u5883\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u6570\u636e\u5e93\u7c7b\u578b\u548c\u5907\u4efd\u9700\u6c42\uff0c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u8fdb\u884c\u6570\u636e\u5e93\u5907\u4efd\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\uff0c\u80fd\u591f\u987a\u5229\u5b9e\u73b0Python\u6267\u884c\u6570\u636e\u5e93\u5907\u4efd\u7684\u529f\u80fd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u8fde\u63a5\u6570\u636e\u5e93\u4ee5\u8fdb\u884c\u5907\u4efd\uff1f<\/strong><br \/>\u8981\u5728Python\u4e2d\u8fde\u63a5\u6570\u636e\u5e93\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u7279\u5b9a\u6570\u636e\u5e93\u7684\u9a71\u52a8\u7a0b\u5e8f\uff0c\u4f8b\u5982<code>sqlite3<\/code>\u7528\u4e8eSQLite\uff0c<code>psycopg2<\/code>\u7528\u4e8ePostgreSQL\uff0c\u6216<code>pymysql<\/code>\u7528\u4e8eMySQL\u3002\u8fde\u63a5\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528SQL\u547d\u4ee4\u751f\u6210\u5907\u4efd\uff0c\u4f8b\u5982\u901a\u8fc7\u5c06\u6570\u636e\u5bfc\u51fa\u5230\u6587\u4ef6\u3002\u786e\u4fdd\u5728\u6267\u884c\u5907\u4efd\u4e4b\u524d\u6b63\u786e\u914d\u7f6e\u8fde\u63a5\u53c2\u6570\uff0c\u5982\u7528\u6237\u540d\u3001\u5bc6\u7801\u548c\u6570\u636e\u5e93\u540d\u79f0\u3002<\/p>\n<p><strong>\u5728\u6267\u884c\u5907\u4efd\u65f6\uff0c\u5982\u4f55\u786e\u4fdd\u6570\u636e\u7684\u5b8c\u6574\u6027\u548c\u5b89\u5168\u6027\uff1f<\/strong><br \/>\u5728\u6267\u884c\u6570\u636e\u5e93\u5907\u4efd\u65f6\uff0c\u91c7\u7528\u4e8b\u52a1\u5904\u7406\u673a\u5236\u53ef\u4ee5\u786e\u4fdd\u6570\u636e\u7684\u4e00\u81f4\u6027\u3002\u4f7f\u7528\u201cBEGIN TRANSACTION\u201d\u547d\u4ee4\u53ef\u4ee5\u5f00\u59cb\u4e00\u4e2a\u4e8b\u52a1\uff0c\u5e76\u5728\u5907\u4efd\u5b8c\u6210\u540e\u4f7f\u7528\u201cCOMMIT\u201d\u6765\u4fdd\u5b58\u66f4\u6539\u3002\u6b64\u5916\uff0c\u5b9a\u671f\u5bf9\u5907\u4efd\u6587\u4ef6\u8fdb\u884c\u52a0\u5bc6\u548c\u5b58\u50a8\u5728\u5b89\u5168\u4f4d\u7f6e\uff0c\u80fd\u591f\u6709\u6548\u4fdd\u62a4\u654f\u611f\u6570\u636e\u514d\u53d7\u672a\u6388\u6743\u8bbf\u95ee\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u81ea\u52a8\u5316\u6570\u636e\u5e93\u5907\u4efd\u8fc7\u7a0b\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u7684\u8c03\u5ea6\u5e93\u5982<code>schedule<\/code>\u6216<code>APScheduler<\/code>\u6765\u81ea\u52a8\u5316\u6570\u636e\u5e93\u5907\u4efd\u8fc7\u7a0b\u3002\u901a\u8fc7\u8bbe\u5b9a\u65f6\u95f4\u95f4\u9694\uff0c\u60a8\u53ef\u4ee5\u7f16\u5199\u811a\u672c\u5b9a\u671f\u6267\u884c\u5907\u4efd\u64cd\u4f5c\u3002\u6b64\u5916\uff0c\u7ed3\u5408\u64cd\u4f5c\u7cfb\u7edf\u7684\u4efb\u52a1\u8c03\u5ea6\u5de5\u5177\uff08\u5982Windows\u7684\u4efb\u52a1\u8ba1\u5212\u7a0b\u5e8f\u6216Linux\u7684cron\uff09\uff0c\u53ef\u4ee5\u5b9e\u73b0\u66f4\u52a0\u7075\u6d3b\u548c\u9ad8\u6548\u7684\u5907\u4efd\u7ba1\u7406\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u6267\u884c\u6570\u636e\u5e93\u5907\u4efd\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528\u6570\u636e\u5e93\u7279\u5b9a\u7684\u5907\u4efd\u5de5\u5177\u3001\u76f4\u63a5\u6267\u884cSQL\u547d\u4ee4\u3001\u4ee5\u53ca\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u7b49\u3002 [&hellip;]","protected":false},"author":3,"featured_media":1115713,"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\/1115701"}],"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=1115701"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1115701\/revisions"}],"predecessor-version":[{"id":1115718,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1115701\/revisions\/1115718"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1115713"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1115701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1115701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1115701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}