Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added sample_data/email/mailing_list.xlsx
Binary file not shown.
Binary file added sample_data/sales/sales.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions src/tutorial/Byzer101/Email.mlsqlnb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"kind":1,"language":"markdown","value":"### Byzer彩蛋功能 - 群发个性+定制化邮件!\n你知道Byzer除了可以作为敲代码加速器之外!\n还有一个很常用的功能 - 就是 群发 个性化 定制化 的邮件!\nMarketing 和 Sales 的同学经常需要发上百上千封邮件\n但是 一般会遇到以下的痛点:\n1. 通过第三方软件发送邮件 经常会被拉黑名单 => 无效广告\n2. 有时候 不能定制化 称谓\n3. 最重要的是 烧钱!!!\n\n所以 Byzer 作为免费群发广告邮件的神器 欢迎大家试用哈 😉\n\n#### Step 1: 创建mailing list, 录入email + firstname + family name\n#### Step 2: 申请发件邮箱授权码 - 具体可以百度 + google\n#### Step 3: 敲代码","outputs":[]},{"kind":2,"language":"mlsql","value":"SET EMAIL_CC = \"xxxxx抄送邮箱xxxxxx\";\nSET USERNAME = \"xxxxx发件邮箱xxxxx\";\nSET PWD = \"xxxxx发件邮箱授权码xxxxxx\";\nSET HOST = \"xxxxx发件邮箱Hostxxxxxx\";\nSET PORT = \"xxxxx发件邮箱Portxxxxxx\";\n\n-- import mailing list\nload excel.`./sample_data/email/mailing_list.xlsx`\nwhere header=\"true\"\nas mailing_list;\n\nselect \n email as to,\n concat(\"致最可爱的\",firstname) as subject,\n concat(\"<div>Hi \",firstname, \",\",\n \"<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 你知道吗? 你炒鸡炒鸡可爱的呢! 就好像她一样哦!<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n <img src=https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F1c4d8ce9dfe40d03dca4d47c6b7fdbf970256cbf9c77f-zNDLvo_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1653034241&t=4ea23529dc4e7cb3eb8bcd0f879fa905 alt=\"\"/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n Byzer天团喊你来敲代码啦 https://www.byzer.org/ </div><br/><hr/>from Lori's Byzer Notebook</div>\") as content\n\nfrom mailing_list\nas mail;\n\n--群发邮件\nrun mail as SendMultiMails.``\nwhere mailType = \"config\"\nand from = \"${USERNAME}\"\nand contentType=\"text/html\"\nand smtpHost = \"${HOST}\"\nand smtpPort = \"${PORT}\"\n-- 设置邮件客户端的协议为 SSL 协议,默认为 SSL 协议,也可选择 TLS 配置:\n-- and `properties.mail.smtp.starttls.enable`= \"true\"\nand `properties.mail.smtp.ssl.protocols`=\"TLSv1.2\"\nand `properties.mail.smtp.ssl.enable`= \"true\"\nand userName = \"${USERNAME}\"\nand password=\"${PWD}\"\n;","outputs":[]}]
1 change: 1 addition & 0 deletions src/tutorial/Byzer101/Excel.mlsqlnb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"kind":1,"language":"markdown","value":"# Byzer 101 for Excel Power-Users\nAs straightforward as the title suggests, let's get hands dirty.\n\nIn this tutorial, we'll use an Excel file that contains 2 sheets: orders and store.\nYou can find the file in mlsql-lang-example-project/sample_data/sales/sales.xlsx.\n\nP.S. Feel free to play with your own Excel workbooks!\n\n## Part 1 - Load Data from an Excel File with Multiple Sheets ","outputs":[]},{"kind":2,"language":"mlsql","value":"-- try this command to find what parameters you can play with using Excel Load&Save Function\n!show datasources/params/excel;","outputs":[]},{"kind":2,"language":"mlsql","value":"-- Load Statement\n-- load excel.`<file_path>`\n-- where header=\"<true/false>\" and dataAddress=\"<sheet_name>!<first_cell>:<last_cell>\"\n-- as <table_name>;\n\n-- Import data from Excel Sheet - Orders into a table called order\nload excel.`./sample_data/sales/sales.xlsx`\nwhere header=\"true\" and dataAddress=\"Orders!A1:I4990\"\nas order;\n\n-- Import data from Excel Sheet - Stores into a table called store\nload excel.`./sample_data/sales/sales.xlsx`\nwhere header=\"true\" and dataAddress=\"Stores!A1:D23\"\nas store;","outputs":[]},{"kind":1,"language":"markdown","value":"## Part 2 - Export Data into an Excel File\nYou can analyze the data by running SQL queries in Byzer and then save those insights into a new Excel file as follows:","outputs":[]},{"kind":2,"language":"mlsql","value":"-- Save Statement: 4 modes - overwrite, append, ignore,errorIfExists\n-- save overwrite/append/ignore/errorIfExists <output_table> \n-- as <json/csv/excel>.`<file_path>` where <filters>;\n\n-- save your insights into a Excel file \nselect count(*) as order_num from order as output;\n\nsave overwrite output as excel.`./sample_data/sales/sales2.xlsx` \nwhere header=\"true\";","outputs":[]}]