From bfec83367bffe1382817ce85e234d6d1940e79ff Mon Sep 17 00:00:00 2001 From: sunshinesmilelk Date: Tue, 26 Nov 2024 16:26:33 +0800 Subject: [PATCH] chore(lab): update guidebook content --- examples/libro_guide_book.ipynb | 38 ++++++++++++++++-- examples/libro_guide_book_zh.ipynb | 38 ++++++++++++++++-- examples/sql_demo | Bin 12288 -> 0 bytes examples/sql_demo.db | Bin 12288 -> 0 bytes .../libro-lab/src/guide/libro_guide_book.json | 38 ++++++++++++++++-- .../src/guide/libro_guide_book_zh.json | 38 ++++++++++++++++-- 6 files changed, 136 insertions(+), 16 deletions(-) delete mode 100644 examples/sql_demo delete mode 100644 examples/sql_demo.db diff --git a/examples/libro_guide_book.ipynb b/examples/libro_guide_book.ipynb index 914eac52..d6343d3f 100644 --- a/examples/libro_guide_book.ipynb +++ b/examples/libro_guide_book.ipynb @@ -82,6 +82,20 @@ "Give it a try now!" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "d7b92e18-dd4c-4309-824e-54820bf5b171", + "metadata": { + "libroCellType": "sql", + "libroFormatter": "formatter-sql-magic" + }, + "outputs": [], + "source": [ + "%%sql \n", + "{\"result_variable\":\"df_1\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"CREATE TABLE products (\\n id INTEGER PRIMARY KEY AUTOINCREMENT, \\n name TEXT NOT NULL, \\n description TEXT, \\n price REAL NOT NULL, \\n stock INTEGER DEFAULT 0, \\n created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, \\n updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP \\n);\"}" + ] + }, { "cell_type": "code", "execution_count": null, @@ -94,7 +108,21 @@ "outputs": [], "source": [ "%%sql \n", - "{\"result_variable\":\"df_1\",\"db_id\":\"sqlite: sql_demo\",\"sql_script\":\"select * from products\"}" + "{\"result_variable\":\"df_2\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"INSERT INTO products (name, description, price, stock) VALUES\\n('Laptop', 'High performance laptop', 1299.99, 15),\\n('Smartphone', 'Latest model smartphone', 899.99, 50),\\n('Headphones', 'Noise-cancelling headphones', 199.99, 30),\\n('Monitor', '4K Ultra HD Monitor', 349.99, 20),\\n('Keyboard', 'Mechanical gaming keyboard', 99.99, 40),\\n('Mouse', 'Wireless ergonomic mouse', 49.99, 60),\\n('Tablet', '10-inch screen tablet', 499.99, 25),\\n('Smartwatch', 'Water-resistant smartwatch', 199.99, 35),\\n('Camera', 'DSLR camera with 4K video', 799.99, 10),\\n('Printer', 'All-in-one wireless printer', 149.99, 18),\\n('Speaker', 'Bluetooth portable speaker', 89.99, 55),\\n('Router', 'Dual-band WiFi router', 59.99, 50),\\n('Desk', 'Adjustable height standing desk', 299.99, 12),\\n('Chair', 'Ergonomic office chair', 199.99, 25),\\n('Hard Drive', '2TB external hard drive', 119.99, 45),\\n('SSD', '1TB SSD for laptops and PCs', 149.99, 50),\\n('Graphics Card', 'High-end gaming graphics card', 699.99, 5),\\n('Power Bank', 'Fast charging power bank', 39.99, 70),\\n('Projector', 'Full HD home projector', 499.99, 8),\\n('Drone', 'Camera drone with GPS', 899.99, 6);\"}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5551d41a-8c8b-45ae-b9e2-a8c342a5d8e5", + "metadata": { + "libroCellType": "sql", + "libroFormatter": "formatter-sql-magic" + }, + "outputs": [], + "source": [ + "%%sql \n", + "{\"result_variable\":\"df_3\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"select * from products\"}" ] }, { @@ -107,7 +135,7 @@ }, "outputs": [], "source": [ - "df_1" + "df_3" ] }, { @@ -265,7 +293,8 @@ "execution_count": null, "id": "310bf74e-295d-4a31-8a36-7109cac02982", "metadata": { - "libroCellType": "prompt" + "libroCellType": "prompt", + "libroFormatter": "formatter-prompt-magic" }, "outputs": [], "source": [ @@ -278,7 +307,8 @@ "execution_count": null, "id": "3281ba0d-ae5d-4510-b7a5-4968b2300e6f", "metadata": { - "libroCellType": "prompt" + "libroCellType": "prompt", + "libroFormatter": "formatter-prompt-magic" }, "outputs": [], "source": [ diff --git a/examples/libro_guide_book_zh.ipynb b/examples/libro_guide_book_zh.ipynb index 1742477e..315ece2e 100644 --- a/examples/libro_guide_book_zh.ipynb +++ b/examples/libro_guide_book_zh.ipynb @@ -82,6 +82,34 @@ "赶快试试吧~" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "a8760c9f-d9f2-4937-ace9-2ae29202b9a8", + "metadata": { + "libroCellType": "sql", + "libroFormatter": "formatter-sql-magic" + }, + "outputs": [], + "source": [ + "%%sql \n", + "{\"result_variable\":\"df_1\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"CREATE TABLE products (\\n id INTEGER PRIMARY KEY AUTOINCREMENT, \\n name TEXT NOT NULL, \\n description TEXT, \\n price REAL NOT NULL, \\n stock INTEGER DEFAULT 0, \\n created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, \\n updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP \\n);\"}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "838adfab-9b5b-4000-9e7d-aa29219960bd", + "metadata": { + "libroCellType": "sql", + "libroFormatter": "formatter-sql-magic" + }, + "outputs": [], + "source": [ + "%%sql \n", + "{\"result_variable\":\"df_2\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"INSERT INTO products (name, description, price, stock) VALUES\\n('Laptop', 'High performance laptop', 1299.99, 15),\\n('Smartphone', 'Latest model smartphone', 899.99, 50),\\n('Headphones', 'Noise-cancelling headphones', 199.99, 30),\\n('Monitor', '4K Ultra HD Monitor', 349.99, 20),\\n('Keyboard', 'Mechanical gaming keyboard', 99.99, 40),\\n('Mouse', 'Wireless ergonomic mouse', 49.99, 60),\\n('Tablet', '10-inch screen tablet', 499.99, 25),\\n('Smartwatch', 'Water-resistant smartwatch', 199.99, 35),\\n('Camera', 'DSLR camera with 4K video', 799.99, 10),\\n('Printer', 'All-in-one wireless printer', 149.99, 18),\\n('Speaker', 'Bluetooth portable speaker', 89.99, 55),\\n('Router', 'Dual-band WiFi router', 59.99, 50),\\n('Desk', 'Adjustable height standing desk', 299.99, 12),\\n('Chair', 'Ergonomic office chair', 199.99, 25),\\n('Hard Drive', '2TB external hard drive', 119.99, 45),\\n('SSD', '1TB SSD for laptops and PCs', 149.99, 50),\\n('Graphics Card', 'High-end gaming graphics card', 699.99, 5),\\n('Power Bank', 'Fast charging power bank', 39.99, 70),\\n('Projector', 'Full HD home projector', 499.99, 8),\\n('Drone', 'Camera drone with GPS', 899.99, 6);\"}" + ] + }, { "cell_type": "code", "execution_count": null, @@ -94,7 +122,7 @@ "outputs": [], "source": [ "%%sql \n", - "{\"result_variable\":\"df_1\",\"db_id\":\"sqlite: sql_demo\",\"sql_script\":\"select * from products\"}" + "{\"result_variable\":\"df_3\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"select * from products\"}" ] }, { @@ -107,7 +135,7 @@ }, "outputs": [], "source": [ - "df_1" + "df_3" ] }, { @@ -263,7 +291,8 @@ "execution_count": null, "id": "310bf74e-295d-4a31-8a36-7109cac02982", "metadata": { - "libroCellType": "prompt" + "libroCellType": "prompt", + "libroFormatter": "formatter-prompt-magic" }, "outputs": [], "source": [ @@ -276,7 +305,8 @@ "execution_count": null, "id": "3281ba0d-ae5d-4510-b7a5-4968b2300e6f", "metadata": { - "libroCellType": "prompt" + "libroCellType": "prompt", + "libroFormatter": "formatter-prompt-magic" }, "outputs": [], "source": [ diff --git a/examples/sql_demo b/examples/sql_demo deleted file mode 100644 index 2257e9a6636b0a12c9b67fe7e2dad93a080de874..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI&!E4h{90&0C(zS!4#=~IjPkk zh%PRdO7xYQ_Kf1NH}S+cJ1Xb8WLKG1WU>Z5R%>wUp5?HnQ>&X!huyb2%xv?+T0<_Z zTMe$K$>es7TMs#F9LmwQ?dkO>9(X>J4{FbRFq*i57>K98Zg75`7yGX8dtJGs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libro_guide_book.json index af2f504f..fbaa527d 100644 --- a/packages/libro-lab/src/guide/libro_guide_book.json +++ b/packages/libro-lab/src/guide/libro_guide_book.json @@ -80,6 +80,20 @@ "Give it a try now!" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "d7b92e18-dd4c-4309-824e-54820bf5b171", + "metadata": { + "libroCellType": "sql", + "libroFormatter": "formatter-sql-magic" + }, + "outputs": [], + "source": [ + "%%sql \n", + "{\"result_variable\":\"df_1\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"CREATE TABLE products (\\n id INTEGER PRIMARY KEY AUTOINCREMENT, \\n name TEXT NOT NULL, \\n description TEXT, \\n price REAL NOT NULL, \\n stock INTEGER DEFAULT 0, \\n created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, \\n updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP \\n);\"}" + ] + }, { "cell_type": "code", "execution_count": null, @@ -92,7 +106,21 @@ "outputs": [], "source": [ "%%sql \n", - "{\"result_variable\":\"df_1\",\"db_id\":\"sqlite: sql_demo\",\"sql_script\":\"select * from products\"}" + "{\"result_variable\":\"df_2\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"INSERT INTO products (name, description, price, stock) VALUES\\n('Laptop', 'High performance laptop', 1299.99, 15),\\n('Smartphone', 'Latest model smartphone', 899.99, 50),\\n('Headphones', 'Noise-cancelling headphones', 199.99, 30),\\n('Monitor', '4K Ultra HD Monitor', 349.99, 20),\\n('Keyboard', 'Mechanical gaming keyboard', 99.99, 40),\\n('Mouse', 'Wireless ergonomic mouse', 49.99, 60),\\n('Tablet', '10-inch screen tablet', 499.99, 25),\\n('Smartwatch', 'Water-resistant smartwatch', 199.99, 35),\\n('Camera', 'DSLR camera with 4K video', 799.99, 10),\\n('Printer', 'All-in-one wireless printer', 149.99, 18),\\n('Speaker', 'Bluetooth portable speaker', 89.99, 55),\\n('Router', 'Dual-band WiFi router', 59.99, 50),\\n('Desk', 'Adjustable height standing desk', 299.99, 12),\\n('Chair', 'Ergonomic office chair', 199.99, 25),\\n('Hard Drive', '2TB external hard drive', 119.99, 45),\\n('SSD', '1TB SSD for laptops and PCs', 149.99, 50),\\n('Graphics Card', 'High-end gaming graphics card', 699.99, 5),\\n('Power Bank', 'Fast charging power bank', 39.99, 70),\\n('Projector', 'Full HD home projector', 499.99, 8),\\n('Drone', 'Camera drone with GPS', 899.99, 6);\"}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5551d41a-8c8b-45ae-b9e2-a8c342a5d8e5", + "metadata": { + "libroCellType": "sql", + "libroFormatter": "formatter-sql-magic" + }, + "outputs": [], + "source": [ + "%%sql \n", + "{\"result_variable\":\"df_3\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"select * from products\"}" ] }, { @@ -104,7 +132,7 @@ "libroFormatter": "formatter-string" }, "outputs": [], - "source": ["df_1"] + "source": ["df_3"] }, { "cell_type": "markdown", @@ -255,7 +283,8 @@ "execution_count": null, "id": "310bf74e-295d-4a31-8a36-7109cac02982", "metadata": { - "libroCellType": "prompt" + "libroCellType": "prompt", + "libroFormatter": "formatter-prompt-magic" }, "outputs": [], "source": [ @@ -268,7 +297,8 @@ "execution_count": null, "id": "3281ba0d-ae5d-4510-b7a5-4968b2300e6f", "metadata": { - "libroCellType": "prompt" + "libroCellType": "prompt", + "libroFormatter": "formatter-prompt-magic" }, "outputs": [], "source": [ diff --git a/packages/libro-lab/src/guide/libro_guide_book_zh.json b/packages/libro-lab/src/guide/libro_guide_book_zh.json index 2119f7ca..b359678b 100644 --- a/packages/libro-lab/src/guide/libro_guide_book_zh.json +++ b/packages/libro-lab/src/guide/libro_guide_book_zh.json @@ -80,6 +80,34 @@ "赶快试试吧~" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "a8760c9f-d9f2-4937-ace9-2ae29202b9a8", + "metadata": { + "libroCellType": "sql", + "libroFormatter": "formatter-sql-magic" + }, + "outputs": [], + "source": [ + "%%sql \n", + "{\"result_variable\":\"df_1\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"CREATE TABLE products (\\n id INTEGER PRIMARY KEY AUTOINCREMENT, \\n name TEXT NOT NULL, \\n description TEXT, \\n price REAL NOT NULL, \\n stock INTEGER DEFAULT 0, \\n created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, \\n updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP \\n);\"}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "838adfab-9b5b-4000-9e7d-aa29219960bd", + "metadata": { + "libroCellType": "sql", + "libroFormatter": "formatter-sql-magic" + }, + "outputs": [], + "source": [ + "%%sql \n", + "{\"result_variable\":\"df_2\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"INSERT INTO products (name, description, price, stock) VALUES\\n('Laptop', 'High performance laptop', 1299.99, 15),\\n('Smartphone', 'Latest model smartphone', 899.99, 50),\\n('Headphones', 'Noise-cancelling headphones', 199.99, 30),\\n('Monitor', '4K Ultra HD Monitor', 349.99, 20),\\n('Keyboard', 'Mechanical gaming keyboard', 99.99, 40),\\n('Mouse', 'Wireless ergonomic mouse', 49.99, 60),\\n('Tablet', '10-inch screen tablet', 499.99, 25),\\n('Smartwatch', 'Water-resistant smartwatch', 199.99, 35),\\n('Camera', 'DSLR camera with 4K video', 799.99, 10),\\n('Printer', 'All-in-one wireless printer', 149.99, 18),\\n('Speaker', 'Bluetooth portable speaker', 89.99, 55),\\n('Router', 'Dual-band WiFi router', 59.99, 50),\\n('Desk', 'Adjustable height standing desk', 299.99, 12),\\n('Chair', 'Ergonomic office chair', 199.99, 25),\\n('Hard Drive', '2TB external hard drive', 119.99, 45),\\n('SSD', '1TB SSD for laptops and PCs', 149.99, 50),\\n('Graphics Card', 'High-end gaming graphics card', 699.99, 5),\\n('Power Bank', 'Fast charging power bank', 39.99, 70),\\n('Projector', 'Full HD home projector', 499.99, 8),\\n('Drone', 'Camera drone with GPS', 899.99, 6);\"}" + ] + }, { "cell_type": "code", "execution_count": null, @@ -92,7 +120,7 @@ "outputs": [], "source": [ "%%sql \n", - "{\"result_variable\":\"df_1\",\"db_id\":\"sqlite: sql_demo\",\"sql_script\":\"select * from products\"}" + "{\"result_variable\":\"df_3\",\"db_id\":\"sqlite: sql_demo.db\",\"sql_script\":\"select * from products\"}" ] }, { @@ -104,7 +132,7 @@ "libroFormatter": "formatter-string" }, "outputs": [], - "source": ["df_1"] + "source": ["df_3"] }, { "cell_type": "markdown", @@ -253,7 +281,8 @@ "execution_count": null, "id": "310bf74e-295d-4a31-8a36-7109cac02982", "metadata": { - "libroCellType": "prompt" + "libroCellType": "prompt", + "libroFormatter": "formatter-prompt-magic" }, "outputs": [], "source": [ @@ -266,7 +295,8 @@ "execution_count": null, "id": "3281ba0d-ae5d-4510-b7a5-4968b2300e6f", "metadata": { - "libroCellType": "prompt" + "libroCellType": "prompt", + "libroFormatter": "formatter-prompt-magic" }, "outputs": [], "source": [