{"id":485760,"date":"2026-07-01T07:59:56","date_gmt":"2026-07-01T07:59:56","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=485760"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=485760","title":{"rendered":"MySQL \u21c4 Excel. \u041a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0435\u0442\u0438 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u0438\u0441\u044f\u0442 \u043c\u0430\u043d\u0443\u0430\u043b\u044b \u0438\u0437 2013, \u0433\u0434\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043d\u0430 PHP \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 PHPExcel \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0438\u043c\u043f\u043e\u0440\u0442 \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 phpMyAdmin. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u043f\u043e\u0442\u044b\u043a\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0436\u0435 \u0442\u044b\u0441\u044f\u0447\u0435 \u0441\u0442\u0440\u043e\u043a: \u0441\u043b\u0435\u0442\u0430\u044e\u0442 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438, \u043b\u043e\u043c\u0430\u044e\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0434\u0430\u0442, \u0430 \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043e \u0446\u0435\u043b\u044b\u0445.<\/p>\n<p>\u041f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441 \u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442\u043e\u043c \u0438\u043b\u0438 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u0435\u0439 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u0435\u0442 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0430. \u041d\u0443\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0437 \u0431\u0430\u0437\u044b \u0432 \u042d\u043a\u0441\u0435\u043b\u044c \u0434\u043b\u044f \u043e\u0442\u0447\u0451\u0442\u0430, \u043b\u0438\u0431\u043e, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0437\u0430\u043b\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0421\u0423\u0411\u0414 \u0442\u044f\u0436\u0435\u043b\u044b\u0439 <strong>xlsx.<\/strong> \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u0432\u0435\u0436\u0438\u043c\u0438 \u0446\u0435\u043d\u0430\u043c\u0438 \u0438\u043b\u0438 \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u043e\u0432. \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0442\u044f\u0436\u0435\u043b\u044b\u0435 ETL-\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0430\u0434\u0438 \u0440\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0448\u0438\u043b\u0430\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e CLI-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Python &#8212; <strong>mysql_bridge<\/strong>. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043a\u0432\u043e\u0437\u043d\u0443\u044e \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044e\u044e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043d\u0430 \u043b\u0435\u0442\u0443. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0438 Readme <a href=\"https:\/\/github.com\/Maxeevru\/MySQL-Excel\" rel=\"noopener noreferrer nofollow\">\u0417\u0434\u0435\u0441\u044c<\/a>. \u0415\u0441\u043b\u0438 \u0412\u0430\u0441 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u0438\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0430\u043c\u0438. <\/p>\n<p><strong>\u041a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u043c\u043e\u0441\u0442    <\/strong><\/p>\n<p>\u0412\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0443\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0441\u0447\u0451\u0442 \u0441\u0432\u044f\u0437\u043a\u0438 <code>pandas<\/code>, <code>sqlalchemy<\/code> \u0438 \u0434\u0432\u0438\u0436\u043a\u0430 <code>openpyxl<\/code>. \u0421\u043a\u0440\u0438\u043f\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u042d\u043a\u0441\u0435\u043b\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0431\u0435\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0444\u0438\u0441\u043d\u043e\u0433\u043e \u0441\u043e\u0444\u0442\u0430. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0434\u0432\u0443\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445.<\/p>\n<ul>\n<li>\n<p><strong>\u042d\u043a\u0441\u043f\u043e\u0440\u0442. \u0418\u0437 MySQL \u0432 Excel<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e SQLAlchemy, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0438 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 DataFrame, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0421\u0423\u0411\u0414.<\/p>\n<p><code>def export_to_excel(table_name, excel_path):<\/code><\/p>\n<p><code>engine = create_engine(DATABASE_URL)<\/code><\/p>\n<p><code>df = <\/code><a href=\"http:\/\/pd.read\" rel=\"noopener noreferrer nofollow\"><code>pd.read<\/code><\/a><code>_sql_table(table_name, con=engine)<\/code><\/p>\n<p><a href=\"http:\/\/df.to\" rel=\"noopener noreferrer nofollow\"><code>df.to<\/code><\/a><code>_excel(excel_path, index=False, engine=\u2018openpyxl\u2019)<\/code><\/p>\n<ul>\n<li>\n<p><strong>\u0418\u043c\u043f\u043e\u0440\u0442.  \u0418\u0437 Excel \u0432 MySQL \u0441 \u0430\u0432\u0442\u043e\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446 <\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0430\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0430 &#8212; \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 MySQL \u0447\u0435\u0440\u0435\u0437 <code>CREATE TABLE<\/code>.<\/p>\n<p>\u0412 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d. Pandas \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u042d\u043a\u0441\u0435\u043b\u044c-\u0444\u0430\u0439\u043b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 (\u0441\u0442\u0440\u043e\u043a\u0438, \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0434\u0430\u0442\u044b) \u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 MySQL \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043b\u0438\u0432\u043a\u043e\u0439 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>\u0424\u043b\u0430\u0433 <code>if_exists='replace'<\/code> \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0440\u0430\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430 \u0432 \u0431\u0430\u0437\u0435, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043f\u043e\u0434 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p><code>def import_from_excel(excel_path, table_name):<\/code><\/p>\n<p><code>engine = create_engine(DATABASE_URL)<\/code><\/p>\n<p><code>df = <\/code><a href=\"http:\/\/pd.read\" rel=\"noopener noreferrer nofollow\"><code>pd.read<\/code><\/a><code>_excel(excel_path, engine=\u2018openpyxl\u2019)<\/code><\/p>\n<p><a href=\"http:\/\/df.to\" rel=\"noopener noreferrer nofollow\"><code>df.to<\/code><\/a><code>_sql(table_name, con=engine, index=False, if_exists=\u2018replace\u2019)<\/code><\/p>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438<\/h2>\n<h2>MySQL -&gt; Excel<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<p><code>pip install pandas openpyxl sqlalchemy pymysql<\/code>. \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0444\u043b\u0430\u0433\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 MySQL \u0432 Excel (<code>--mode export<\/code>) \u0438\u043b\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e (<code>--mode import<\/code>), \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c  \u043d\u0430 \u043c\u043e\u0451\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<\/p>\n<ul>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 VS Code \u0438 \u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<p><code>pip install pandas openpyxl sqlalchemy pymysql<\/code><\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/86f\/6fa\/ca1\/86f6faca1016a6771f3e0d181847195a.png\" width=\"1432\" height=\"422\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/86f\/6fa\/ca1\/86f6faca1016a6771f3e0d181847195a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/86f\/6fa\/ca1\/86f6faca1016a6771f3e0d181847195a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<ul>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 <code>bridge.py<\/code> \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u043a \u043d\u0430\u0448\u0435\u0439 \u0431\u0434 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>DATABASE_URL<\/code>. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 <code>medoiy_magazin<\/code>. <\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0442\u043e\u0432\u0430\u0440\u043e\u0432 <code>products<\/code> \u0432 \u0444\u0430\u0439\u043b Excel. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441 \u0444\u043b\u0430\u0433\u0430\u043c\u0438:<\/p>\n<p><code>python bridge.py --mode export --table products --file products.xlsx<\/code><\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/15b\/390\/c43\/15b390c4313acd9a32d2ba72cc267624.png\" alt=\"\u0422\u0430\u0431\u043b\u0438\u0446\u0430 products \u0432 MySQL\" title=\"\u0422\u0430\u0431\u043b\u0438\u0446\u0430 products \u0432 MySQL\" width=\"986\" height=\"508\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/15b\/390\/c43\/15b390c4313acd9a32d2ba72cc267624.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/15b\/390\/c43\/15b390c4313acd9a32d2ba72cc267624.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 products \u0432 MySQL<\/strong><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5f1\/dc1\/790\/5f1dc1790244d1b2c879f6851b3907c0.png\" alt=\"\u041e\u043d\u0430 \u0436\u0435, \u043d\u043e \u0443\u0436\u0435 \u0432 \u042d\u043a\u0441\u0435\u043b\u044c\" title=\"\u041e\u043d\u0430 \u0436\u0435, \u043d\u043e \u0443\u0436\u0435 \u0432 \u042d\u043a\u0441\u0435\u043b\u044c\" width=\"872\" height=\"505\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/5f1\/dc1\/790\/5f1dc1790244d1b2c879f6851b3907c0.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5f1\/dc1\/790\/5f1dc1790244d1b2c879f6851b3907c0.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u041e\u043d\u0430 \u0436\u0435, \u043d\u043e \u0443\u0436\u0435 \u0432 \u042d\u043a\u0441\u0435\u043b\u044c<\/strong><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ce8\/f6d\/92f\/ce8f6d92f4a3f62395a9c607fb756bf9.png\" alt=\"\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b\" title=\"\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b\" width=\"1432\" height=\"370\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/ce8\/f6d\/92f\/ce8f6d92f4a3f62395a9c607fb756bf9.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ce8\/f6d\/92f\/ce8f6d92f4a3f62395a9c607fb756bf9.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b<\/strong><\/figcaption><\/div>\n<\/figure>\n<h2>Excel -&gt; MySQL<\/h2>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0437\u0430\u043b\u044c\u0435\u043c \u0435\u0433\u043e \u0432 \u0421\u0423\u0411\u0414. \u0421\u043a\u0440\u0438\u043f\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0444\u0430\u0439\u043b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u0442\u0438\u043f\u044b \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0441\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 <code>excel_workers<\/code> ,\u0432 \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 <code>medoiy_magazin<\/code> \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430:<\/p>\n<p><code>python bridge.py --mode import --file taste.xlsx --table taste.<\/code><\/p>\n<p>\u0412\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u042d\u043a\u0441\u0435\u043b\u044c \u0432 MySQL<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c9c\/81e\/907\/c9c81e9071e60f4452e36e373f0f5f9b.png\" alt=\"\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0432 \u042d\u043a\u0441\u0435\u043b\u044c\" title=\"\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0432 \u042d\u043a\u0441\u0435\u043b\u044c\" width=\"447\" height=\"386\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/c9c\/81e\/907\/c9c81e9071e60f4452e36e373f0f5f9b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c9c\/81e\/907\/c9c81e9071e60f4452e36e373f0f5f9b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0432 \u042d\u043a\u0441\u0435\u043b\u044c<\/strong><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c1c\/228\/a6a\/c1c228a6aa5fa6ee3d364b5c21b006b7.png\" alt=\"\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b\" title=\"\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b\" width=\"1338\" height=\"457\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/c1c\/228\/a6a\/c1c228a6aa5fa6ee3d364b5c21b006b7.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c1c\/228\/a6a\/c1c228a6aa5fa6ee3d364b5c21b006b7.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><strong>\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b<\/strong><\/figcaption><\/div>\n<\/figure>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/10a\/287\/43d\/10a28743dda9dbf5a6598f9093af0537.png\" alt=\"\" title=\"\" width=\"411\" height=\"356\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/10a\/287\/43d\/10a28743dda9dbf5a6598f9093af0537.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/10a\/287\/43d\/10a28743dda9dbf5a6598f9093af0537.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0421\u0423\u0411\u0414 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044f CLI-\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u044f\u0436\u0435\u043b\u044b\u0445 ETL-\u0441\u0438\u0441\u0442\u0435\u043c. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0433\u0440\u0443\u0437\u043e\u043a \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b, \u0430 \u043a\u043e\u0434 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b \u0434\u043b\u044f \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438. \u041f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u043d\u0430 GitHub \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u0435\u0433\u043e.      <a href=\"https:\/\/github.com\/Maxeevru\/MySQL-Excel\" rel=\"noopener noreferrer nofollow\">\u0421\u044e\u0434\u0430<\/a><\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1054274\/\">https:\/\/habr.com\/ru\/articles\/1054274\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u0441\u0435\u0442\u0438 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u0438\u0441\u044f\u0442 \u043c\u0430\u043d\u0443\u0430\u043b\u044b \u0438\u0437 2013, \u0433\u0434\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043d\u0430 PHP \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 PHPExcel \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0438\u043c\u043f\u043e\u0440\u0442 \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 phpMyAdmin. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u043f\u043e\u0442\u044b\u043a\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0436\u0435 \u0442\u044b\u0441\u044f\u0447\u0435 \u0441\u0442\u0440\u043e\u043a: \u0441\u043b\u0435\u0442\u0430\u044e\u0442 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438, \u043b\u043e\u043c\u0430\u044e\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0434\u0430\u0442, \u0430 \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043e \u0446\u0435\u043b\u044b\u0445.\u041f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441 \u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442\u043e\u043c \u0438\u043b\u0438 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u0435\u0439 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u0435\u0442 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0430. \u041d\u0443\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0437 \u0431\u0430\u0437\u044b \u0432 \u042d\u043a\u0441\u0435\u043b\u044c \u0434\u043b\u044f \u043e\u0442\u0447\u0451\u0442\u0430, \u043b\u0438\u0431\u043e, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0437\u0430\u043b\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0421\u0423\u0411\u0414 \u0442\u044f\u0436\u0435\u043b\u044b\u0439 xlsx. \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u0432\u0435\u0436\u0438\u043c\u0438 \u0446\u0435\u043d\u0430\u043c\u0438 \u0438\u043b\u0438 \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u0433\u0435\u043d\u0442\u043e\u0432. \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0442\u044f\u0436\u0435\u043b\u044b\u0435 ETL-\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0430\u0434\u0438 \u0440\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0448\u0438\u043b\u0430\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e CLI-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Python &#8212; mysql_bridge. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043a\u0432\u043e\u0437\u043d\u0443\u044e \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044e\u044e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043d\u0430 \u043b\u0435\u0442\u0443. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0438 Readme \u0417\u0434\u0435\u0441\u044c. \u0415\u0441\u043b\u0438 \u0412\u0430\u0441 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u0438\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0430\u043c\u0438. \u041a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u043c\u043e\u0441\u0442    \u0412\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0443\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0441\u0447\u0451\u0442 \u0441\u0432\u044f\u0437\u043a\u0438 pandas, sqlalchemy \u0438 \u0434\u0432\u0438\u0436\u043a\u0430 openpyxl. \u0421\u043a\u0440\u0438\u043f\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u042d\u043a\u0441\u0435\u043b\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0431\u0435\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0444\u0438\u0441\u043d\u043e\u0433\u043e \u0441\u043e\u0444\u0442\u0430. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0434\u0432\u0443\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445.\u042d\u043a\u0441\u043f\u043e\u0440\u0442. \u0418\u0437 MySQL \u0432 Excel\u0414\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e SQLAlchemy, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0438 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 DataFrame, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0421\u0423\u0411\u0414.def export_to_excel(table_name, excel_path):engine = create_engine(DATABASE_URL)df = pd.read_sql_table(table_name, con=engine)df.to_excel(excel_path, index=False, engine=\u2018openpyxl\u2019)\u0418\u043c\u043f\u043e\u0440\u0442.  \u0418\u0437 Excel \u0432 MySQL \u0441 \u0430\u0432\u0442\u043e\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446 \u0421\u0430\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0430 &#8212; \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 MySQL \u0447\u0435\u0440\u0435\u0437 CREATE TABLE.\u0412 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d. Pandas \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u042d\u043a\u0441\u0435\u043b\u044c-\u0444\u0430\u0439\u043b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 (\u0441\u0442\u0440\u043e\u043a\u0438, \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0434\u0430\u0442\u044b) \u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 MySQL \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043b\u0438\u0432\u043a\u043e\u0439 \u0441\u0442\u0440\u043e\u043a.\u0424\u043b\u0430\u0433 if_exists=&#8217;replace&#8217; \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u0440\u0430\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430 \u0432 \u0431\u0430\u0437\u0435, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043f\u043e\u0434 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0444\u0430\u0439\u043b\u0430.def import_from_excel(excel_path, table_name):engine = create_engine(DATABASE_URL)df = pd.read_excel(excel_path, engine=\u2018openpyxl\u2019)df.to_sql(table_name, con=engine, index=False, if_exists=\u2018replace\u2019)\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438MySQL -&gt; Excel\u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443pip install pandas openpyxl sqlalchemy pymysql. \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0444\u043b\u0430\u0433\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 MySQL \u0432 Excel (&#8212;mode export) \u0438\u043b\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e (&#8212;mode import), \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c  \u043d\u0430 \u043c\u043e\u0451\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435.\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 VS Code \u0438 \u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:pip install pandas openpyxl sqlalchemy pymysql\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 bridge.py \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u043a \u043d\u0430\u0448\u0435\u0439 \u0431\u0434 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e DATABASE_URL. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 medoiy_magazin. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0442\u043e\u0432\u0430\u0440\u043e\u0432 products \u0432 \u0444\u0430\u0439\u043b Excel. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441 \u0444\u043b\u0430\u0433\u0430\u043c\u0438:python bridge.py &#8212;mode export &#8212;table products &#8212;file products.xlsx\u0422\u0430\u0431\u043b\u0438\u0446\u0430 products \u0432 MySQL\u041e\u043d\u0430 \u0436\u0435, \u043d\u043e \u0443\u0436\u0435 \u0432 \u042d\u043a\u0441\u0435\u043b\u044c\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043bExcel -&gt; MySQL\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0437\u0430\u043b\u044c\u0435\u043c \u0435\u0433\u043e \u0432 \u0421\u0423\u0411\u0414. \u0421\u043a\u0440\u0438\u043f\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0444\u0430\u0439\u043b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u0442\u0438\u043f\u044b \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0441\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 excel_workers ,\u0432 \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 medoiy_magazin \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430:python bridge.py &#8212;mode import &#8212;file taste.xlsx &#8212;table taste.\u0412\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u042d\u043a\u0441\u0435\u043b\u044c \u0432 MySQL\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0432 \u042d\u043a\u0441\u0435\u043b\u044c\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0421\u0423\u0411\u0414 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044f CLI-\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u044f\u0436\u0435\u043b\u044b\u0445 ETL-\u0441\u0438\u0441\u0442\u0435\u043c. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0433\u0440\u0443\u0437\u043e\u043a \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b, \u0430 \u043a\u043e\u0434 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b \u0434\u043b\u044f \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438. \u041f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u043d\u0430 GitHub \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0442\u0435 \u0435\u0433\u043e.      \u0421\u044e\u0434\u0430\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 https:\/\/habr.com\/ru\/articles\/1054274\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-485760","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/485760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=485760"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/485760\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=485760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=485760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=485760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}