GlueSQL
SQL Database Engine as a Library
GlueSQL is a SQL database library written in Rust.
It provides a parser (sqlparser-rs), execution layer, and optional storages (sled or memory) packaged into a single library.
Developers can choose to use GlueSQL to build their own SQL database, or as an embedded SQL database using the default storage engine.
Standalone Mode
You can use GlueSQL as an embedded SQL database.
GlueSQL provides two reference storage options.
SledStorage- Persistent storage engine based onsledMemoryStorage- Non-persistent storage engine based onBTreeMap
Installation
Cargo.toml
[]
= "0.10"
- CLI application
$ cargo install gluesql
Usage
use *;
SQL Library Mode (For Custom Storage)
Installation
sled-storage and memory-storage features are optional, so these are not required for custom storage makers.
[]
= "0.10"
= false
= ["alter-table", "index", "transaction", "metadata"]
Four features below are also optional
alter-table- ALTER TABLE query supportindex- CREATE INDEX and DROP INDEX, index supporttransaction- BEGIN, ROLLBACK and COMMIT, transaction supportmetadata- SHOW TABLES and SHOW VERSION support
Usage
Two mandatory store traits to implement
Optional store traits
SQL Features
GlueSQL currently supports a limited subset of queries. It's being actively developed.
Data Types
- Numeric
INT(8),INTEGER,FLOAT,DECIMAL - Date
DATE,TIMESTAMP,TIMEINTERVAL BOOLEAN,TEXT,UUID,MAP,LIST
Queries
CREATE TABLE,DROP TABLEALTER TABLE-ADD COLUMN,DROP COLUMN,RENAME COLUMNandRENAME TO.CREATE INDEX,DROP INDEXINSERT,UPDATE,DELETE,SELECTGROUP BY,HAVINGORDER BY- Transaction queries:
BEGIN,ROLLBACKandCOMMIT - Nested select, join, aggregations ...
You can see tests for the currently supported queries in test-suite/src/*.
Use Cases
GlueSQL-js
https://github.com/gluesql/gluesql-js Use SQL in web browsers! GlueSQL-js provides 3 storage options,
- in-memory
- localStorage
- sessionStorage
GlueSQL Sheets
https://sheets.gluesql.com
Turn Google Sheets into a SQL database!
It uses Google Sheets as a storage.
Data is stored and updated from Google Sheets.
Other expected use cases
- Add SQL layer to NoSQL databases: Redis, CouchDB...
- Build new SQL database management system
Contribution
There are a few simple rules to follow.
- No
mutkeywords in thecoreworkspace (exceptglue.rs). - Every error must have corresponding integration test cases to generate.
(except forUnreachable-andConflict-error types)