{"id":20661006,"url":"https://github.com/liatemplates/alasql","last_synced_at":"2026-02-26T02:36:36.942Z","repository":{"id":107256825,"uuid":"157871714","full_name":"LiaTemplates/AlaSQL","owner":"LiaTemplates","description":"Use alaSQL in LiaScript to create interactive SQL courses. AlaSQL is a lightweight client-side in-memory SQL database designed to work in browser. It Handles both traditional relational tables and nested JSON data (NoSQL).","archived":false,"fork":false,"pushed_at":"2020-12-02T19:25:54.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-12T11:05:58.904Z","etag":null,"topics":["alasql","liascript","liascript-template","sql","sql-tutorial","template"],"latest_commit_sha":null,"homepage":"https://liascript.github.io/course/?https://raw.githubusercontent.com/liaTemplates/alasql/master/README.md","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LiaTemplates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-16T13:33:00.000Z","updated_at":"2025-04-24T12:28:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef49892c-3340-4077-9c76-2c46be14e346","html_url":"https://github.com/LiaTemplates/AlaSQL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LiaTemplates/AlaSQL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FAlaSQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FAlaSQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FAlaSQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FAlaSQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LiaTemplates","download_url":"https://codeload.github.com/LiaTemplates/AlaSQL/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FAlaSQL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29848634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"online","status_checked_at":"2026-02-26T02:00:06.774Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alasql","liascript","liascript-template","sql","sql-tutorial","template"],"created_at":"2024-11-16T19:06:46.275Z","updated_at":"2026-02-26T02:36:36.906Z","avatar_url":"https://github.com/LiaTemplates.png","language":null,"readme":"\u003c!--\nauthor:   André Dietrich\n\nemail:    andre.dietrich@ovgu.de\n\nversion:  0.2.3\n\nlanguage: en\n\nnarrator: US English Female\n\nlogo:     https://jquery-plugins.net/image/plugin/alasql-javascript-sql-database-library.png\n\ncomment:  Macros for executing SQL code snippets with AlaSQL in LiaScript.\n\nscript:   https://cdn.jsdelivr.net/npm/alasql@0.6.5/dist/alasql.min.js\n\nattribute: [AlaSQL](https://alasql.org)\n           by [Andrey Gershun](agershun@gmail.com)\n           \u0026 [Mathias Rangel Wulff](m@rawu.dk)\n           is licensed under [MIT](https://opensource.org/licenses/MIT)\n\n\nscript:  https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.6.1/papaparse.min.js\n\nattribute: [PapaParse](https://www.papaparse.com)\n           by [Matthew Holt](https://twitter.com/mholt6)\n           is licensed under [MIT](https://opensource.org/licenses/MIT)\n\n@AlaSQL.eval\n\u003cscript\u003e\ntry {\n\n  JSON.stringify(alasql(`@input`), null, 3);\n\n\n\n\n} catch(e) {\n  let error = new LiaError(e.message, 1);\n  try {\n    let log = e.message.match(/.*line (\\d):.*\\n.*\\n.*\\n(.*)/);\n    error.add_detail(0, e.name+\": \"+log[2], \"error\", log[1] -1 , 0);\n  } catch(e) {\n  }\n  throw error;\n}\n\n\u003c/script\u003e\n@end\n\n\n@AlaSQL.eval_with_csv\n\u003cscript\u003e\nlet data = Papa.parse(`@input(1)`, {header: true});\n\nlet error = \"\";\nif(data.errors.length != 0) {\n    error = JSON.stringify(data.errors, null, 3)+\"\\n\";\n}\n\ntry {\n  error += JSON.stringify(alasql(`@input`, [data.data]), null, 3);\n} catch(e) {\n  let error = new LiaError(e.message, 1);\n  try {\n    let log = e.message.match(/.*line (\\d):.*\\n.*\\n.*\\n(.*)/);\n    error.add_detail(0, e.name+\": \"+log[2], \"error\", log[1] -1 , 0);\n  } catch(e) {}\n  throw error ;\n}\n\u003c/script\u003e\n@end\n\n--\u003e\n\n# AlaSQL - Template\n\nThis is a template for developing interactive SQL courses with LiaScript and\n[AlaSQL](http://alasql.org).\n\n__Try it on LiaScript:__\n\nhttps://liascript.github.io/course/?https://raw.githubusercontent.com/liaTemplates/AlaSQL/master/README.md\n\n__See the project on Github:__\n\nhttps://github.com/liaTemplates/AlaSQL\n\n\n                         --{{1}}--\nThere are three ways to use this template. The easiest way is to use the\n`import` statement and the url of the raw text-file of the master branch or any\nother branch or version. But you can also copy the required functionionality\ndirectly into the header of your Markdown document, see therefor the\n[last slide](#4). And of course, you could also clone this project and change\nit, as you wish.\n\n                           {{1}}\n1. Load the macros via\n\n   `import: https://raw.githubusercontent.com/liaTemplates/AlaSQL/master/README.md`\n\n2. Copy the definitions into your Project\n\n3. Clone this repository on GitHub\n\n\n## `@AlaSQL.eval`\n\n                         --{{0}}--\nAdd the macro `@AlaSQL.eval` to the end of every SQL code-block that you want to\nmake executable and editable in LiaScript. The given code gets evaluate by the\nAlaSQL interpreter and the result is shown in a console below.\n\n\n``` sql\nCREATE TABLE test (language INT, hello STRING);\n\n-- insert dummy values\nINSERT INTO test VALUES (1,'Hello!');\nINSERT INTO test VALUES (2,'Aloha!');\nINSERT INTO test VALUES (3,'Bonjour!');\n\nSELECT * FROM test WHERE language \u003e 1;\n```\n@AlaSQL.eval\n\n\n                         --{{1}}--\nSince AlaSQL has its own \"runtime-environment\", you can use as many scripts and\nonly have to take care of the names.\n\n\n                           {{1}}\n``` sql\n/*\nselect some stuff\n*/\nSELECT * FROM test WHERE language \u003e 1;\n```\n@AlaSQL.eval\n\n\n## `@AlaSQL.eval_with_csv`\n\n                         --{{0}}--\nUse `@AlaSQL.eval_with_csv` with two subsequent code-blocks, whereby the first\nblock is used to define a table and the second the CSV data with a header in the\nfirst line. [PapaParse](https://www.papaparse.com) is applied for CSV-parsing,\nsee the next section for the implementation.\n\n``` sql\nCREATE TABLE one;\n\n-- ? gets replaced by the values in data.csv\nINSERT INTO one SELECT * from ?;\n```\n``` text -data.csv\nRegion,Country,Item Type,Sales Channel,Order Priority,Order Date,Order ID,Ship Date,Units Sold,Unit Price,Unit Cost,Total Revenue,Total Cost,Total Profit\nMiddle East and North Africa,Libya,Cosmetics,Offline,M,10/18/2014,686800706,10/31/2014,8446,437.20,263.33,3692591.20,2224085.18,1468506.02\nNorth America,Canada,Vegetables,Online,M,11/7/2011,185941302,12/8/2011,3018,154.06,90.93,464953.08,274426.74,190526.34\nMiddle East and North Africa,Libya,Baby Food,Offline,C,10/31/2016,246222341,12/9/2016,1517,255.28,159.42,387259.76,241840.14,145419.62\nAsia,Japan,Cereal,Offline,C,4/10/2010,161442649,5/12/2010,3322,205.70,117.11,683335.40,389039.42,294295.98\nSub-Saharan Africa,Chad,Fruits,Offline,H,8/16/2011,645713555,8/31/2011,9845,9.33,6.92,91853.85,68127.40,23726.45\nEurope,Armenia,Cereal,Online,H,11/24/2014,683458888,12/28/2014,9528,205.70,117.11,1959909.60,1115824.08,844085.52\nSub-Saharan Africa,Eritrea,Cereal,Online,H,3/4/2015,679414975,4/17/2015,2844,205.70,117.11,585010.80,333060.84,251949.96\nEurope,Montenegro,Clothes,Offline,M,5/17/2012,208630645,6/28/2012,7299,109.28,35.84,797634.72,261596.16,536038.56\nCentral America and the Caribbean,Jamaica,Vegetables,Online,H,1/29/2015,266467225,3/7/2015,2428,154.06,90.93,374057.68,220778.04,153279.64\nAustralia and Oceania,Fiji,Vegetables,Offline,H,12/24/2013,118598544,1/19/2014,4800,154.06,90.93,739488.00,436464.00,303024.00\nSub-Saharan Africa,Togo,Clothes,Online,M,12/29/2015,451010930,1/19/2016,3012,109.28,35.84,329151.36,107950.08,221201.28\nEurope,Montenegro,Snacks,Offline,M,2/27/2010,220003211,3/18/2010,2694,152.58,97.44,411050.52,262503.36,148547.16\nEurope,Greece,Household,Online,C,11/17/2016,702186715,12/22/2016,1508,668.27,502.54,1007751.16,757830.32,249920.84\nSub-Saharan Africa,Sudan,Cosmetics,Online,C,12/20/2015,544485270,1/5/2016,4146,437.20,263.33,1812631.20,1091766.18,720865.02\nAsia,Maldives,Fruits,Offline,L,1/8/2011,714135205,2/6/2011,7332,9.33,6.92,68407.56,50737.44,17670.12\nEurope,Montenegro,Clothes,Offline,H,6/28/2010,448685348,7/22/2010,4820,109.28,35.84,526729.60,172748.80,353980.80\nEurope,Estonia,Office Supplies,Online,H,4/25/2016,405997025,5/12/2016,2397,651.21,524.96,1560950.37,1258329.12,302621.25\nNorth America,Greenland,Beverages,Online,M,7/27/2012,414244067,8/7/2012,2880,47.45,31.79,136656.00,91555.20,45100.80\nSub-Saharan Africa,Cape Verde,Clothes,Online,C,9/8/2014,821912801,10/3/2014,1117,109.28,35.84,122065.76,40033.28,82032.48\nSub-Saharan Africa,Senegal,Household,Offline,L,8/27/2012,247802054,9/8/2012,8989,668.27,502.54,6007079.03,4517332.06,1489746.97\n```\n@AlaSQL.eval_with_csv\n\n\n                         --{{1}}--\nAfterwards you can again use `@AlaSQL.eval` to define code for analyzing the\nnewly integrated table.\n\n                           {{1}}\n``` sql\n/*\nselect some stuff\n*/\nSELECT Region FROM one;\n```\n@AlaSQL.eval\n\n\n                           {{1}}\n``` sql\nSELECT * FROM one Where Region == \"North America\";\n```\n@AlaSQL.eval\n\n\n## Implementation\n\n                         --{{0}}--\nThe code shows the implementation of the two AlaSQL macros. The scripts load the\nJavaScript libraries for AlaSQL and PapaParse. PapaParse is used to parse a\ngiven string of CSV.\n\n``` js\nscript:  https://cdnjs.cloudflare.com/ajax/libs/alasql/0.4.11/alasql-worker.min.js\n         https://cdnjs.cloudflare.com/ajax/libs/alasql/0.4.11/alasql.min.js\n\nscript:  https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.6.1/papaparse.min.js\n\n@AlaSQL.eval\n\u003cscript\u003e\ntry {\n  JSON.stringify(alasql(`@input`), null, 3);\n} catch(e) {\n  let error = new LiaError(e.message, 1);\n  try {\n    let log = e.message.match(/.*line (\\d):.*\\n.*\\n.*\\n(.*)/);\n    error.add_detail(0, e.name+\": \"+log[2], \"error\", log[1] -1 , 0);\n  } catch(e) {}\n  throw error ;\n}\n\u003c/script\u003e\n@end\n\n@AlaSQL.eval_with_csv\n\u003cscript\u003e\nlet data = Papa.parse(`@input(1)`, {header: true});\n\nlet error = \"\";\nif(data.errors.length != 0) {\n    error = JSON.stringify(data.errors, null, 3)+\"\\n\";\n}\n\ntry {\n  error += JSON.stringify(alasql(`@input`, [data.data]), null, 3);\n} catch(e) {\n  let error = new LiaError(e.message, 1);\n  try {\n    let log = e.message.match(/.*line (\\d):.*\\n.*\\n.*\\n(.*)/);\n    error.add_detail(0, e.name+\": \"+log[2], \"error\", log[1] -1 , 0);\n  } catch(e) {}\n  throw error ;\n}\n\u003c/script\u003e\n@end\n\n```\n\n                         --{{1}}--\nIf you want to minimize loading effort in your LiaScript project, you can also\ncopy this code and paste it into your main comment header, see the code in the\nraw file of this document.\n\n{{1}} https://raw.githubusercontent.com/liaTemplates/AlaSQL/master/README.md\n\n\n## More Information\n\nTo find out more about AlaSQL, visit the project site: http://alasql.org\n\nor the Wiki at: https://github.com/agershun/alasql/wiki\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliatemplates%2Falasql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliatemplates%2Falasql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliatemplates%2Falasql/lists"}