{"id":13472916,"url":"https://github.com/AlaSQL/alasql","last_synced_at":"2025-03-26T17:31:28.651Z","repository":{"id":22442487,"uuid":"25780780","full_name":"AlaSQL/alasql","owner":"AlaSQL","description":"AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.","archived":false,"fork":false,"pushed_at":"2024-10-23T17:22:35.000Z","size":95452,"stargazers_count":7028,"open_issues_count":438,"forks_count":656,"subscribers_count":133,"default_branch":"develop","last_synced_at":"2024-10-29T10:32:17.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://alasql.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlaSQL.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-26T16:30:37.000Z","updated_at":"2024-10-28T04:58:35.000Z","dependencies_parsed_at":"2023-09-24T14:32:58.600Z","dependency_job_id":"80f5728a-0b97-4e43-8ed5-b1d79be46bfa","html_url":"https://github.com/AlaSQL/alasql","commit_stats":{"total_commits":1982,"total_committers":99,"mean_commits":20.02020202020202,"dds":0.6029263370332997,"last_synced_commit":"9ea01ac44b033d7c0e9bc5ddecca70638ed95c60"},"previous_names":["agershun/alasql"],"tags_count":135,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlaSQL%2Falasql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlaSQL%2Falasql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlaSQL%2Falasql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlaSQL%2Falasql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlaSQL","download_url":"https://codeload.github.com/AlaSQL/alasql/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245401393,"owners_count":20609167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-07-31T16:00:59.107Z","updated_at":"2025-03-26T17:31:28.642Z","avatar_url":"https://github.com/AlaSQL.png","language":"JavaScript","readme":"- _AlaSQL is an unfunded open source project installed 250k+ times each month. [Please donate your time](https://github.com/AlaSQL/alasql/issues?q=is%3Aopen+label%3A%22Help+wanted%22+sort%3Aupdated-desc). We appreciate any and all contributions we can get._\n\n- _Have a question? [Ask the AlaSQL bot](https://chat.openai.com/g/g-XcBL24WTe-alasql-bot) or post on [Stack Overflow](http://stackoverflow.com/questions/ask?tags=AlaSQL)._\n\n[![CI-test](https://github.com/alasql/alasql/workflows/CI%20build%20\u0026%20test/badge.svg)](https://github.com/alasql/alasql/actions)\n[![NPM downloads](http://img.shields.io/npm/dm/alasql.svg?style=flat\u0026label=npm%20downloads)](https://npm-stat.com/charts.html?package=alasql)\n[![OPEN open source software](https://img.shields.io/badge/Open--OSS-%E2%9C%94-brightgreen.svg)](http://open-oss.com)\n[![Release](https://img.shields.io/github/release/alasql/alasql.svg?label=npm\u0026a)](https://www.npmjs.com/package/alasql)\n[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/AlaSQL/alasql.svg)](http://isitmaintained.com/project/AlaSQL/alasql \"Average time to resolve an issue\")\n[![Coverage]( https://img.shields.io/codecov/c/github/alasql/alasql/develop.svg)](https://rawgit.com/alasql/alasql/develop/test/coverage/lcov-report/dist/alasql.fs.js.html)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/AlaSQL/alasql/badge)](https://securityscorecards.dev/viewer/?uri=github.com/AlaSQL/alasql)\n[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/328/badge)](https://bestpractices.coreinfrastructure.org/projects/328)\n[![](https://data.jsdelivr.com/v1/package/npm/alasql/badge?style=rounded)](https://www.jsdelivr.com/package/npm/alasql)\n[![Stars](https://img.shields.io/github/stars/alasql/alasql.svg?label=Github%20%E2%98%85\u0026a)](https://github.com/alasql/alasql)\n\n\n\n\n# AlaSQL\n\n\u003ch2 align=\"center\"\u003e\u003ca href=\"http://alasql.org\"\u003e\u003cimg src=\"https://cloud.githubusercontent.com/assets/1063454/19309516/94f8007e-9085-11e6-810f-62fd60b42185.png\" alt=\"AlaSQL logo\" styl=\"max-width:80%\"/\u003e\u003c/a\u003e\n\u003c/h2\u003e\n\n\n\nAlaSQL - _( [à la](http://en.wiktionary.org/wiki/%C3%A0_la) [SQL](http://en.wikipedia.org/wiki/SQL) ) [ælæ ɛskju:ɛl]_ - is an open source SQL database for JavaScript with a strong focus on query speed and data source flexibility for both relational data and schemaless data.  It works in the web browser, Node.js, and mobile apps.\n\nThis library is perfect for:\n\n* Fast in-memory SQL data processing for BI and ERP applications on fat clients\n* Easy ETL and options for persistence by data import / manipulation / export of several formats\n* All major browsers, Node.js, and mobile applications\n\nWe focus on [speed](https://github.com/alasql/alasql/wiki/Speed) by taking advantage of the dynamic nature of JavaScript when building up queries. Real-world solutions demand flexibility regarding where data comes from and where it is to be stored. We focus on flexibility by making sure you can [import/export](https://github.com/alasql/alasql/wiki/Import-export) and query directly on data stored in Excel (both `.xls` and `.xlsx`), CSV, JSON, TAB, IndexedDB, LocalStorage, and SQLite files.\n\nThe library adds the comfort of a full database engine to your JavaScript app. No, really - it's working towards a full database engine complying with [most of the SQL-99 language](https://github.com/alasql/alasql/wiki/Supported-SQL-statements), spiced up with additional syntax for NoSQL (schema-less) data and graph networks.\n\n\n#### Traditional SQL Table\n\n```js\n/* create SQL Table and add data */\nalasql(\"CREATE TABLE cities (city string, pop number)\");\n\nalasql(\"INSERT INTO cities VALUES ('Paris',2249975),('Berlin',3517424),('Madrid',3041579)\");\n\n/* execute query */\nvar res = alasql(\"SELECT * FROM cities WHERE pop \u003c 3500000 ORDER BY pop DESC\");\n\n// res = [ { \"city\": \"Madrid\", \"pop\": 3041579 }, { \"city\": \"Paris\", \"pop\": 2249975 } ]\n```\n\n[Live Demo](https://jsfiddle.net/jqk80ard/)\n\n#### Array of Objects\n\n```js\nvar data = [ {a: 1, b: 10}, {a: 2, b: 20}, {a: 1, b: 30} ];\n\nvar res = alasql('SELECT a, SUM(b) AS b FROM ? GROUP BY a',[data]);\n\n// res = [ { \"a\": 1, \"b\": 40},{ \"a\": 2, \"b\": 20 } ]\n```\n\n[Live Demo](https://jsfiddle.net/8brvex4f/)\n\n#### Spreadsheet\n\n```js\n// file is read asynchronously (Promise returned when SQL given as array)\nalasql(['SELECT * FROM XLS(\"./data/mydata\") WHERE lastname LIKE \"A%\" and city = \"London\" GROUP BY name '])\n    .then(function(res){\n        console.log(res); // output depends on mydata.xls\n    }).catch(function(err){\n        console.log('Does the file exist? There was an error:', err);\n    });\n```\n\n\n#### Bulk Data Load\n\n```js\nalasql(\"CREATE TABLE example1 (a INT, b INT)\");\n\n// alasql's data store for a table can be assigned directly\nalasql.tables.example1.data = [\n    {a:2,b:6},\n    {a:3,b:4}\n];\n\n// ... or manipulated with normal SQL\nalasql(\"INSERT INTO example1 VALUES (1,5)\");\n\nvar res = alasql(\"SELECT * FROM example1 ORDER BY b DESC\");\n\nconsole.log(res); // [{a:2,b:6},{a:1,b:5},{a:3,b:4}]\n```\n\n__If you are familiar with SQL, it should be no surprise that proper use of indexes on your tables is essential for good performance.__\n\n#### Options\n\nAlaSQL has several [configuration options](https://github.com/AlaSQL/alasql/wiki/AlaSQL-Options) which change the behavior. It can be set via SQL statements or via the options object before using `alasql`. \n\nIf you're using `NOW()` in queries often, setting `alasql.options.dateAsString` to `false` speed things up. It will just return a JS Date object instead of a string representation of a date. \n\n## Installation\n\n\n```bash\nyarn add alasql                # yarn\n\nnpm install alasql             # npm\n\nnpm install -g alasql          # global install of command line tool\n```\n\nFor the browsers: include [alasql.min.js](https://cdn.jsdelivr.net/npm/alasql)\n\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/alasql@4\"\u003e\u003c/script\u003e\n```\n\n\n## Getting started\n\nSee the [\"Getting started\" section of the wiki](https://github.com/alasql/alasql/wiki/Getting%20started)\n\nMore advanced topics are covered in other wiki sections like [\"Data manipulation\"](https://github.com/alasql/alasql/wiki/Data-manipulation) and in questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/alasql)\n\nOther links:\n\n* Documentation: [Github wiki](https://github.com/alasql/alasql/wiki)\n\n* Library CDN: [jsDelivr.com](http://www.jsdelivr.com/#!alasql)\n\n* Feedback: [Open an issue](https://github.com/alasql/alasql/issues/new)\n\n* Try online: \u003ca href=\"http://alasql.org/console?CREATE TABLE cities (city string, population number);INSERT INTO cities VALUES ('Rome',2863223), ('Paris',2249975),('Berlin',3517424), ('Madrid',3041579);SELECT * FROM cities WHERE population \u003c 3500000 ORDER BY population DESC\"\u003ePlayground\u003c/a\u003e\n\n* Website: [alasql.org](http://AlaSQL.org)\n\n\n## Please note\n\n**All contributions are extremely welcome and greatly appreciated(!)** -\nThe project has never received any funding and is based on unpaid voluntary work: [We really (really) love pull requests](https://github.com/alasql/alasql/blob/develop/CONTRIBUTING.md)\n\nThe AlaSQL project depends on your contribution of code and \u003cs\u003emay\u003c/s\u003e have [bugs](https://github.com/alasql/alasql/labels/%21%20Bug). So please, submit any bugs and suggestions [as an issue](https://github.com/alasql/alasql/issues/new).\n\nPlease check out the [limitations of the library](https://github.com/alasql/alasql#limitations).\n\n## Performance\n\nAlaSQL is designed for speed and includes some of the classic SQL engine optimizations:\n\n* Queries are cached as compiled functions\n* Joined tables are pre-indexed\n* `WHERE` expressions are pre-filtered for joins\n\nSee more [performance-related info on the wiki](https://github.com/alasql/alasql/wiki/Speed)\n\n## Features you might like\n\n\n### Traditional SQL\n\nUse \"good old\" SQL on your data with multiple levels of: `JOIN`, `VIEW`, `GROUP BY`, `UNION`, `PRIMARY KEY`, `ANY`, `ALL`, `IN`, `ROLLUP()`, `CUBE()`, `GROUPING SETS()`, `CROSS APPLY`, `OUTER APPLY`, `WITH SELECT`, and subqueries. [The wiki lists supported SQL statements and keywords](https://github.com/alasql/alasql/wiki/SQL%20keywords).\n\n\n\n### User-Defined Functions in your SQL\n\nYou can use all benefits of SQL and JavaScript together by defining your own custom functions. Just add new functions to the alasql.fn object:\n\n\n```js\nalasql.fn.myfn = function(a,b) {\n    return a*b+1;\n};\nvar res = alasql('SELECT myfn(a,b) FROM one');\n```\n\nYou can also define your own aggregator functions (like your own `SUM(...)`). See more [in the wiki](https://github.com/alasql/alasql/wiki/User-Defined-Functions)\n\n\n### Compiled statements and functions\n\n```js\nvar ins = alasql.compile('INSERT INTO one VALUES (?,?)');\nins(1,10);\nins(2,20);\n```\n\nSee more [in the wiki](https://github.com/alasql/alasql/wiki/Compile)\n\n\n### SELECT against your JavaScript data\n\nGroup your JavaScript array of objects by field and count number of records in each group:\n\n```js\nvar data = [{a:1,b:1,c:1},{a:1,b:2,c:1},{a:1,b:3,c:1}, {a:2,b:1,c:1}];\nvar res = alasql('SELECT a, COUNT(*) AS b FROM ? GROUP BY a', [data] );\n```\n\nSee more ideas for creative data manipulation [in the wiki](https://github.com/alasql/alasql/wiki/Getting-started)\n\n\n\n### JavaScript Sugar\n\nAlaSQL extends \"good old\" SQL to make it closer to JavaScript. The \"sugar\" includes:\n\n* Write Json objects - `{a:'1',b:@['1','2','3']}`\n\n* Access object properties - `obj-\u003eproperty-\u003esubproperty`\n* Access object and arrays elements - `obj-\u003e(a*1)`\n* Access JavaScript functions - `obj-\u003evalueOf()`\n* Format query output with `SELECT VALUE, ROW, COLUMN, MATRIX`\n* ES5 multiline SQL with `var SQL = function(){/*SELECT 'MY MULTILINE SQL'*/}` and pass instead of SQL string (will not work if you compress your code)\n\n\n### Read and write Excel and raw data files\n\nYou can import from and export to CSV, TAB, TXT, and JSON files. File extensions can be omitted. Calls to files will always be asynchronous so multi-file queries should be chained:\n\n```js\nvar tabFile = 'mydata.tab';\n\nalasql.promise([\n    \"SELECT * FROM txt('MyFile.log') WHERE [0] LIKE 'M%'\", // parameter-less query\n    [ \"SELECT * FROM tab(?) ORDER BY [1]\", [tabFile] ],    // [query, array of params]\n    \"SELECT [3] AS city,[4] AS population FROM csv('./data/cities')\",\n    \"SELECT * FROM json('../config/myJsonfile')\"\n]).then(function(results){\n    console.log(results);\n}).catch(console.error);\n```\n\n\n### Read SQLite database files\n\nAlaSQL can read (but not write) SQLite data files using [SQL.js](https://github.com/sql-js/sql.js) library:\n\n```html\n\u003cscript src=\"alasql.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"sql.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    alasql([\n        'ATTACH SQLITE DATABASE Chinook(\"Chinook_Sqlite.sqlite\")',\n        'USE Chinook',\n        'SELECT * FROM Genre'\n    ]).then(function(res){\n        console.log(\"Genres:\",res.pop());\n    });\n\u003c/script\u003e\n```\n\n`sql.js` calls will always be asynchronous.\n\n\n### AlaSQL works in the console - CLI\n\nThe node module ships with an `alasql` command-line tool:\n\n```bash\n$ npm install -g alasql ## install the module globally\n\n$ alasql -h ## shows usage information\n\n$ alasql \"SET @data = @[{a:'1',b:?},{a:'2',b:?}]; SELECT a, b FROM @data;\" 10 20\n[ 1, [ { a: 1, b: 10 }, { a: 2, b: 20 } ] ]\n\n$ alasql \"VALUE OF SELECT COUNT(*) AS abc FROM TXT('README.md') WHERE LENGTH([0]) \u003e ?\" 140\n// Number of lines with more than 140 characters in README.md\n```\n\n[More examples are included in the wiki](https://github.com/alasql/alasql/wiki/AlaSQL-CLI)\n\n\n## Features you might love\n\n### AlaSQL ♥ D3.js\n\nAlaSQL plays nice with d3.js and gives you a convenient way to integrate a specific subset of your data with the visual powers of D3. See more about [D3.js and AlaSQL in the wiki](https://github.com/alasql/alasql/wiki/d3.js)\n\n### AlaSQL ♥ Excel\n\nAlaSQL can export data to both [Excel 2003 (.xls)](https://github.com/alasql/alasql/wiki/XLS) and [Excel 2007 (.xlsx)](https://github.com/alasql/alasql/wiki/XLSX) formats with coloring of cells and other Excel formatting functions.\n\n### AlaSQL ♥ Meteor\n\nMeteor is amazing. You can query directly on your Meteor collections with SQL - simple and easy. See more about [Meteor and AlaSQL in the wiki](https://github.com/alasql/alasql/wiki/Meteor)\n\n### AlaSQL ♥ Angular.js\n\nAngular is great. In addition to normal data manipulation, AlaSQL works like a charm for exporting your present scope to Excel. See more about [Angular and AlaSQL in the wiki](https://github.com/alasql/alasql/wiki/Angular.js)\n\n### AlaSQL ♥ Google Maps\n\nPinpointing data on a map should be easy. AlaSQL is great to prepare source data for Google Maps from, for example, Excel or CSV, making it one unit of work for fetching and identifying what's relevant. See more about [Google Maps and AlaSQL in the wiki](https://github.com/alasql/alasql/wiki/Google-maps)\n\n### AlaSQL ♥ Google Spreadsheets\n\nAlaSQL can query data directly from a Google spreadsheet. A good \"partnership\" for easy editing and powerful data manipulation. See more about [Google Spreadsheets and AlaSQL in the wiki](https://github.com/alasql/alasql/wiki/Google-Spreadsheets)\n\n### Miss a feature?\nTake charge and [add your idea](http://feathub.com/alasql/alasql/features/new) or [vote for your favorite feature](http://feathub.com/alasql/alasql) to be implemented:\n\n[![Feature Requests](http://feathub.com/alasql/alasql?format=svg)](http://feathub.com/alasql/alasql)\n\n\n## Limitations\n\nPlease be aware that AlaSQL has [bugs](https://github.com/alasql/alasql/labels/Bug). Beside having some bugs, there are a number of limitations:\n\n0. AlaSQL has a (long) list of keywords that must be escaped if used for column names. When selecting a field named `key` please write ``` SELECT `key` FROM ... ``` instead. This is also the case for words like ``` `value` ```, ``` `read` ```, ``` `count` ```, ``` `by` ```, ``` `top` ```, ``` `path` ```, ``` `deleted` ```, ``` `work` ``` and ``` `offset` ```. Please consult the [full list of keywords](https://github.com/alasql/alasql/wiki/AlaSQL-Keywords).\n\n0. It is OK to `SELECT` 1000000 records or to `JOIN` two tables with 10000 records in each (You can use streaming functions to work with longer datasources - see [test/test143.js](test/test143.js)) but be aware that the workload is multiplied so `SELECT`ing from more than 8 tables with just 100 rows in each will show bad performance. This is one of our top priorities to make better.\n\n0. Limited functionality for transactions (supports only for localStorage) - Sorry, transactions are limited, because AlaSQL switched to more complex approach for handling `PRIMARY KEY`s / `FOREIGN KEY`s. Transactions will be fully turned on again in a future version.\n\n0. A `(FULL) OUTER JOIN` and `RIGHT JOIN` of more than 2 tables will not produce expected results. `INNER JOIN` and `LEFT JOIN` are OK.\n\n0. Please use aliases when you want fields with the same name from different tables (`SELECT a.id AS a_id, b.id AS b_id FROM ?`).\n\n0. At the moment AlaSQL does not work with JSZip 3.0.0 - please use version 2.x.\n\n0. `JOIN`ing a sub-`SELECT` does not work. Please use a `with` structure ([Example here](https://github.com/alasql/alasql/issues/832#issuecomment-377574550)) or fetch the sub-`SELECT` to a variable and pass it as an argument ([Example here](https://github.com/alasql/alasql/issues/832#issuecomment-377559478)).\n\n0. AlaSQL uses the [FileSaver.js](https://github.com/eligrey/FileSaver.js/) library for saving files locally from the browser. Please be aware that it does not save files in Safari 8.0.\n\nThere are probably many others. Please help us fix them by [submitting an issue](https://github.com/alasql/alasql/issues). Thank you!\n\n\n## How To\n\n### Use AlaSQL to convert data from CSV to Excel\n\nETL example:\n\n```js\nalasql([\n    'CREATE TABLE IF NOT EXISTS geo.country',\n    'SELECT * INTO geo.country FROM CSV(\"country.csv\",{headers:true})',\n    'SELECT * INTO XLSX(\"asia\") FROM geo.country WHERE continent_name = \"Asia\"'\n]).then(function(res){\n    // results from the file asia.xlsx\n});\n```\n\n### Use AlaSQL as a Web Worker\n\nAlaSQL can run in a Web Worker. Please be aware that all interaction with AlaSQL when running must be async.\n\nFrom the browser thread, the browser build `alasql-worker.min.js` automagically uses Web Workers:\n\n```html\n\u003cscript src=\"alasql-worker.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nvar arr = [{a:1},{a:2},{a:1}];\n\nalasql([['SELECT * FROM ?',[arr]]]).then(function(data){\n    console.log(data);\n});\n\u003c/script\u003e\n```\n\n[Live Demo](https://jsfiddle.net/3vnmu2fo).\n\nThe standard build `alasql.min.js` will use Web Workers if `alasql.worker()` is called:\n\n```html\n\u003cscript src=\"alasql.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nalasql.worker();\nalasql(['SELECT VALUE 10']).then(function(res){\n    console.log(res);\n}).catch(console.error);\n\u003c/script\u003e\n```\n\n[Live Demo](http://jsfiddle.net/osxvdp5k/).\n\nFrom a Web Worker, you can import `alasql.min.js` with `importScripts`:\n\n```js\nimportScripts('alasql.min.js');\n```\n\n### Webpack, Browserify, Vue and React (Native)\n\nWhen targeting the browser, several code bundlers like Webpack and Browserify will pick up modules you might not want.\n\nHere's a list of modules that AlaSQL may require in certain environments or for certain features:\n\n* Node.js\n  * fs\n  * net\n  * tls\n  * request\n  * path\n* React Native\n  * react-native\n  * react-native-fs\n  * react-native-fetch-blob\n* Vertx\n  * vertx\n* Agonostic\n  * XLSX/XLS support\n    * cptable\n    * jszip\n    * xlsx\n    * cpexcel\n  * es6-promise\n\n#### Webpack\n\nThere are several ways to handle AlaSQL with Webpack:\n\n##### IgnorePlugin\n\nIdeal when you want to control which modules you want to import.\n\n```js\nvar IgnorePlugin =  require(\"webpack\").IgnorePlugin;\n\nmodule.exports = {\n  ...\n  // Will ignore the modules fs, path, xlsx, request, vertx, and react-native modules\n  plugins:[new IgnorePlugin(/(^fs$|cptable|jszip|xlsx|^es6-promise$|^net$|^tls$|^forever-agent$|^tough-cookie$|cpexcel|^path$|^request$|react-native|^vertx$)/)]\n};\n```\n\n##### module.noParse\n\nAs of AlaSQL 0.3.5, you can simply tell Webpack not to parse AlaSQL, which avoids all the dynamic `require` warnings and avoids using `eval`/clashing with CSP with script-loader.\n[Read the Webpack docs about noParse](https://webpack.js.org/configuration/module/#modulenoparse)\n\n```js\n...\n//Don't parse alasql\n{module:noParse:[/alasql/]}\n```\n\n\n##### script-loader\n\nIf both of the solutions above fail to meet your requirements, you can load AlaSQL with [script-loader](https://github.com/webpack/script-loader).\n\n```js\n//Load alasql in the global scope with script-loader\nimport \"script!alasql\"\n```\n\nThis can cause issues if you have a CSP that doesn't allow `eval`.\n\n#### Browserify\n\nRead up on [excluding](https://github.com/substack/browserify-handbook#excluding), [ignoring](https://github.com/substack/browserify-handbook#ignoring), and [shimming](https://github.com/substack/browserify-handbook#shimming)\n\nExample (using excluding)\n\n```js\nvar browserify = require(\"browserify\");\nvar b = browserify(\"./main.js\").bundle();\n//Will ignore the modules fs, path, xlsx\n[\"fs\",\"path\",\"xlsx\",  ... ].forEach(ignore =\u003e { b.ignore(ignore) });\n```\n\n#### Vue\n\nFor some frameworks (lige Vue) alasql cant access XLSX by it self. We recommend handling it by including AlaSQL the following way:\n\n```import alasql from 'alasql';\nimport XLSX from 'xlsx';\nalasql.utils.isBrowserify = false;\nalasql.utils.global.XLSX = XLSX;\n```\n\n#### jQuery\n\nPlease remember to send the original event, and not the jQuery event, for elements. (Use `event.originalEvent` instead of `myEvent`)\n\n### JSON-object\n\nYou can use JSON objects in your databases (do not forget use == and !== operators for deep comparison of objects):\n\n```sql\n\nalasql\u003e SELECT VALUE {a:'1',b:'2'}\n\n{a:1,b:2}\n\nalasql\u003e SELECT VALUE {a:'1',b:'2'} == {a:'1',b:'2'}\n\ntrue\n\nalasql\u003e SELECT VALUE {a:'1',b:'2'}-\u003eb\n\n2\n\nalasql\u003e SELECT VALUE {a:'1',b:(2*2)}-\u003eb\n\n4\n\n```\n\nTry AlaSQL JSON objects in Console [sample](http://alasql.org/console?drop table if exists one;create table one;insert into one values {a:@[1,2,3],c:{e:23}}, {a:@[{b:@[1,2,3]}]};select * from one)\n\n\n## Experimental\n\n_Useful stuff, but there might be dragons_\n\n### Graphs\n\nAlaSQL is a multi-paradigm database with support for graphs that can be searched or manipulated.\n\n```js\n// Who loves lovers of Alice?\nvar res = alasql('SEARCH / ANY(\u003e\u003e \u003e\u003e #Alice) name');\nconsole.log(res) // ['Olga','Helen']\n```\n\nSee more [in the wiki](https://github.com/alasql/alasql/wiki/GRAPH)\n\n### localStorage and DOM-storage\n\nYou can use browser localStorage and [DOM-storage](https://github.com/node-browser-compat/dom-storage) as a data storage. Here is a sample:\n\n```js\nalasql('CREATE localStorage DATABASE IF NOT EXISTS Atlas');\nalasql('ATTACH localStorage DATABASE Atlas AS MyAtlas');\nalasql('CREATE TABLE IF NOT EXISTS MyAtlas.City (city string, population number)');\nalasql('SELECT * INTO MyAtlas.City FROM ?',[ [\n        {city:'Vienna', population:1731000},\n        {city:'Budapest', population:1728000}\n] ]);\nvar res = alasql('SELECT * FROM MyAtlas.City');\n```\n\nTry this sample in [jsFiddle](http://jsfiddle.net/agershun/x1gq3wf2/). Run this sample\ntwo or three times, and AlaSQL store more and more data in localStorage. Here, \"Atlas\" is\nthe name of localStorage database, where \"MyAtlas\" is a memory AlaSQL database.\n\nYou can use localStorage in two modes: `SET AUTOCOMMIT ON` to immediate save data\nto localStorage after each statement or `SET AUTOCOMMIT OFF`. In this case, you need\nto use `COMMIT` statement to save all data from in-memory mirror to localStorage.\n\n### Plugins\n\nAlaSQL supports plugins. To install a plugin you need to use the `REQUIRE` statement. See more [in the wiki](https://github.com/alasql/alasql/wiki/Plugins)\n\n### Alaserver - simple database server\n\nYes, you can even use AlaSQL as a very simple server for tests.\n\nTo run enter the command:\n\n```bash\n$ alaserver\n```\n\nthen open \u003chttp://127.0.0.1:1337/?SELECT%20VALUE%20(2*2)\u003e in your browser\n\nWarning: Alaserver is not multi-threaded, not concurrent, and not secured.\n\n\n## Tests\n\n### Regression tests\n\nAlaSQL currently has over 1200 regression tests, but they only cover [![Coverage]( https://img.shields.io/codecov/c/github/alasql/alasql/develop.svg)](https://rawgit.com/alasql/alasql/develop/test/coverage/lcov-report/dist/alasql.fs.js.html)\nof the codebase.\n\nAlaSQL uses `mocha` for regression tests. Install `mocha` and run\n\n```bash\n$ npm test\n```\n\nor open [test/index.html](test/index.html) for in-browser tests (Please serve via localhost with, for example, `http-server`).\n\n#### Tests with AlaSQL ASSERT from SQL\n\nYou can use AlaSQL's [ASSERT](wiki/Assert) operator to test the results of previous operation:\n\n```sql\nCREATE TABLE one (a INT);             ASSERT 1;\nINSERT INTO one VALUES (1),(2),(3);   ASSERT 3;\nSELECT * FROM one ORDER BY a DESC;    ASSERT [{a:3},{a:2},{a:1}];\n```\n\n#### SQLLOGICTEST\n\nAlaSQL uses `SQLLOGICTEST` to test its compatibility with SQL-99. The tests include about 2 million queries and statements.\n\nThe testruns can be found in the [testlog](TESTLOG.md).\n\n## Rebuilding the parser \n\nTo rebuild the parser, follow these steps:\n\n* Make changes to alasqlparser.jison\n* `npm install -g jison`\n* `npm run jison`\n* `npm test` to validate the changes made\n* Commit changes to alasqlparser.jison and alasqlparser.js\n\n\n## Contributing\n\nSee [Contributing](CONTRIBUTING.md) for details.\n\nThanks to all the people who already contributed!\n\n\u003ca href=\"https://github.com/alasql/alasql/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contributors-img.web.app/image?repo=alasql/alasql\" /\u003e\n\u003c/a\u003e\n\n**Main contributors**\n\n* [Andrey Gershun](https://github.com/alasql)\n* [Mathias Rangel Wulff](https://twitter.com/rangelwulff)\n\nAlaSQL is an [OPEN Open Source Project](http://openopensource.org/). This means that:\n\n\u003e Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.\n\nWe appreciate any and all contributions we can get. If you feel like contributing, have a look at [CONTRIBUTING.md](https://github.com/alasql/alasql/blob/develop/CONTRIBUTING.md)\n\n\n\n## Sponsors\n\nWe extend our heartfelt thanks to each and every sponsor for generously supporting the AlaSQL open-source project by providing infrastructure at no cost. Their contributions enhance the development experience, and we highly recommend exploring their offerings.\n\n\n### Faster GitHub Actions with Blacksmith\n\n[Blacksmith](https://www.blacksmith.sh/?source=alasql) significantly improves the speed of our GitHub Actions workflows by offering more powerful machines and enhanced caching mechanisms. Transitining was a one-line change and it has reduced our automated test times from 70-90 seconds to 15-17 seconds.\n\n\u003ca href=\"https://www.blacksmith.sh/?source=alasql\"\u003e\n    \u003cimg src=\"https://github.com/user-attachments/assets/a85a8a5f-65fd-48e1-aaad-b3f247248928\" alt=\"Blacksmith Logo\" width=\"300\"\u003e\n\u003c/a\u003e\n\n----\n\n### Browser Testing on Physical Devices with BrowserStack\n\n[BrowserStack](https://www.browserstack.com/?source=alasql) enables us to run automated tests in real browsers on physical devices to help us identify cross-browser issues early.\n\n\u003ca href=\"https://www.browserstack.com/?source=alasql\"\u003e\n    \u003cimg src=\"https://github.com/user-attachments/assets/9f74c25b-7dde-4a62-944e-8f23fc399ba9\" alt=\"BrowserStack Logo\" width=\"300\"\u003e\n\u003c/a\u003e\n\n----\n\n### Development Practice Tracking with OpenSSF\n\nThe [Open Source Security Foundation (OpenSSF)](https://openssf.org) provides automated tools to evaluate and monitor the development practices in our repository, ensuring we maintain high standards of security and reliability.\n\n\u003cdiv style=\"background-color: #321e6b; padding: 10px;\"\u003e\n    \u003ca href=\"https://openssf.org\"\u003e\n        \u003cimg src=\"https://github.com/user-attachments/assets/30a5e4ef-62b2-431d-905e-19ce5f9b6048\" alt=\"OpenSSF Logo\" width=\"300\"\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n\n\n## License\n\nMIT - see [MIT licence information](LICENSE)\n\n\n\n\n## Credits\n\nMany thanks to:\n\n* Zach Carter for [Jison parser-generator](https://github.com/zaach/jison)\n* Andrew Kent for [JS SQL Parser](https://github.com/forward/sql-parser)\n* Eli Grey for [FileSaver.js](https://github.com/eligrey/FileSaver.js)\n* [SheetJS](https://sheetjs.com) for [JS XLSX Library](https://github.com/SheetJS/js-xlsx)\n\nand other people for useful tools, which make our work much easier.\n\n### Related projects that have inspired us\n\n* [AlaX](http://github.com/alasql/alax) - Export to Excel with colors and formats\n* [AlaMDX](http://github.com/alasql/alamdx) - JavaScript MDX OLAP library (work in progress)\n* [Other similar projects](http://github.com/alasql/alasql/wiki/Similar-Projects.md) - list of databases on JavaScript\n\n\n\n----\n\u003ca href=\"http://alasql.org\"\u003e\u003cimg src=\"https://cloud.githubusercontent.com/assets/1063454/14003946/d6e5c076-f156-11e5-8238-e62d2a8d20dc.png\" align=\"right\" alt=\"AlaSQL logo\"/\u003e\u003c/a\u003e\n© 2014-2024, Andrey Gershun (agershun@gmail.com) \u0026 Mathias Rangel Wulff (m@rawu.dk)\n\nSee [this article](https://console.substack.com/p/console-187) for a bit of information about the motivation and background. \n","funding_links":[],"categories":["JavaScript","Repository","Load testing","Databases"],"sub_categories":["Database","collection"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlaSQL%2Falasql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAlaSQL%2Falasql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlaSQL%2Falasql/lists"}