Releases: gluesql/gluesql
v0.16.3
What's Changed
- Upgraded to sqlparser from 0.46 to 0.47 by @LucaCappelletti94 in #1569
- Bump webpack from 5.89.0 to 5.94.0 in /docs by @dependabot in #1567
- Upgrading from SqlParser 0.47 to 0.48 by @LucaCappelletti94 in #1570
- Upgrading from SQL Parser 0.48 to 0.49 by @LucaCappelletti94 in #1571
- Upgraded to Sql Parser 0.50 by @LucaCappelletti94 in #1572
- Bump body-parser and express in /docs by @dependabot in #1576
- Add MongoStorage to GlueSQL Rust pkg by @panarch in #1580
- Add the number of dropped tables to Payload::DropTable by @devgony in #1551
- Fix shared memory storage features and crates names mismatch by @edezhic in #1583
- Add AlterTable store trait default implementation, by @panarch in #1586
New Contributors
Full Changelog: v0.16.2...v0.16.3
v0.16.2
v0.16.1
Changes
- Prepare release v0.16.1 @github-actions (#1563)
- Fix empty commit, Add command validation on GitStorage @devgony (#1550)
- Update file based storage to take AsRef<Path> for init @panarch (#1558)
- Add GitStorage to GlueSQL Rust package @panarch (#1548)
- Fix GitStorage pull_and_push test not to fail if .tmp/ not exists @panarch (#1546)
- Fix drop_table to return early if schema not found with IF EXISTS @devgony (#1552)
π Bug Fixes
v0.16.0 π
π Features
- GitStorage @panarch (#1532)
- FileStorage @panarch (#1529)
- Support Foreign key constraint @devgony (#1400)
- Add Expr::Array support for LIST data type @ChobobDev (#1303)
- Implement
parquet
storage @zmrdltl (#1269) - Implement Mongo storage @devgony (#1261)
Changes
- Prepare release v0.16.0 @github-actions (#1544)
- Update README.md & docs/index - add file & git storages @panarch (#1543)
- Publish automation @panarch (#1494)
- Add CSV Storage docs to README.md & Docs @panarch (#1534)
- Update javascript.yml gh action wasm-pack version to 0.13.0 @panarch (#1533)
- Update core/Cargo.toml to fix chrono version to 0.4.33 @panarch (#1535)
- Clean up module imports in WebStorage lib.rs @panarch (#1530)
- Rename test-suite 'store' test case to 'store_insert_schema' @panarch (#1531)
- Reformatted imports @LucaCappelletti94 (#1527)
- Resolved clippy code smells across code base @LucaCappelletti94 (#1525)
- Remove workspace renaming for storage crates @devgony (#1510)
- Refactor SledStorage::new to accept AsRef<Path> for filename parameter @harudagondi (#1507)
- Export CsvStorage in GlueSQL Rust package @panarch (#1501)
- Rename EvaluateError::ValueNotFound to IdentifierNotFound, @panarch (#1500)
- refactor: simplify
Value::validate_type()
@MRGRAVITY817 (#1498) - Remove mal-formed and unused parquet samples @devgony (#1497)
- Update coverage gh action to run in only linux @panarch (#1496)
- Add prepare-release gh action that bump versions and create PR @panarch (#1492)
- Upgrade sqlparser-rs version to v0.46, @panarch (#1486)
- Update Rust toolchain version to 1.76 @panarch (#1487)
- Upgrade sqlparser-rs version to v0.45 @panarch (#1485)
- Added bytea to AST builder @LucaCappelletti94 (#1482)
- Add AST builder test cases for data selection and data projection @sanghee4346 (#1461)
- Add table comment support on CREATE TABLE @panarch (#1476)
- Make some columns in GLUE_TABLE_COLUMNS nullable, @panarch (#1479)
- Upgrade sqlparser-rs version to v0.40.0 @panarch (#1478)
- Bump rustls from 0.21.10 to 0.21.11 @dependabot (#1477)
- Bump mio from 0.8.10 to 0.8.11 @dependabot (#1472)
- Added Clone trait to Payload @LucaCappelletti94 (#1475)
- Replace rust-toolchain to use rust-toolchain.toml, TOML based @panarch (#1470)
- Add column comment support on CREATE TABLE, @panarch (#1469)
- Add uuid function to AST builder which generate UUID typed string @panarch (#1468)
- Update ast_builder/insert.rs to export only node structs @panarch (#1467)
- Add explicit lifetime to RowIter in Store::scan_data @panarch (#1466)
- Simplify error conversion codes in IdbStorage, @panarch (#1465)
- Fix insert_schema to overwrite if exsits on {MongoStorage, IdbStorage} @devgony (#1464)
- Exclude tests {mongo, redis} with features @devgony (#1463)
- Update GitHub Action dependency versions, @panarch (#1459)
- Split rust.yml gh-action single test job into multiple jobs @panarch (#1458)
- Update JS related gh actions node version to 20 @panarch (#1456)
- Upgrade
idb-storage
dependencies @devashishdxt (#1453) - Update AST builder UpdateFilterNode .filter(..) behavior, @panarch (#1455)
- Update AST builder UpdateNode to enforce .filter(..) before .set(..), @panarch (#1454)
- Update coverage action to run on self-hosted runner @panarch (#1443)
- feat: implement keys function @PzaThief (#1441)
- chore: bump
[sqlparser, itertools, stum_macros, ordered-float]
@ever0de (#1440)
π Bug Fixes
- Fix panic in SledStorage tx_timeout calculation by re-arranging terms @JakkuSakura (#1504)
v0.15.0 π
π Breaking Changes
π Python Support
Code Samples
from gluesql import Glue, MemoryStorage
from tabulate import tabulate
db = Glue(MemoryStorage())
sql = """
SELECT
u.name as user,
d.name as device
FROM User u
JOIN Device d ON u.id = d.userId
""".strip().replace(
" ", ""
)
result = db.query(sql)
rows = result[0].get("rows")
print(f"\n[Query]\n{sql}")
print(tabulate(rows, headers="keys", showindex=True, tablefmt="simple_outline"))
- feat: Implement Python Binding @jopemachine (#1357)
π Redis Storage
π CSV Storage
- Add CsvStorage support to CLI & Rust package @panarch (#1437)
- Implement CSV Storage, @panarch (#1280)
π More operators and functions
- feat: add index_by node @seonghun-dev (#1355)
- Implement DEDUP function @jinlee0 (#1430)
- Bitwise Shift Right Operator Implementation @2-NOW (#1394)
- feat: implement ast_builder for values function @tgsong827 (#1375)
- Implement
ADD_MONTH
function @kite707 (#1341) - Implement
SPLICE
function @jinlee0 (#1371) - Implement
SLICE
function @Kwontaehwon (#1340) - Implement entries in ast builder @2-NOW (#1364)
- Implement GREATEST function @TheMan1697 (#1312)
- Implement bitwise-not operator (~) in ast builder @gurugio (#1366)
- Implement COALESCE function @cake-monotone (#1333)
- feat: Implement select without table function in ast_builder @ding-co (#1365)
- Add ExprWithAliasNode to ast builder @julia-ing (#1359)
- feat: Implement take function in ast_builder @ding-co (#1346)
- Implement last_day function in ast_builder @cjy13753 (#1344)
- Implement LAST_DAY function #1315 @cjy13753 (#1323)
- Implement ast_builder for is_empty function @julia-ing (#1337)
- Implement
ast_builder
for skip function @cl-kim (#1334) - Implement ENTRIES function @2-NOW (#1315)
- Feature/operator bit not @gurugio (#1321)
- Implement Skip function @cl-kim (#1325)
- Implement VALUES function for Map type @tgsong827 (#1288)
- Feat: impl bitwise-and operation @jinlee0 (#1281)
- Implement BIT_SHIFT_LEFT operation @codernineteen (#1286)
- implement
SORT
function @Jaehui-Lee (#1300) - feat: Implement
LENGTH
function @jopemachine (#1298) - [Function] Implement TAKE function @ding-co (#1283)
- feat: implement
ast_builder
for replace function @ChobobDev (#1275) - feat: implement IS_EMPTY function @julia-ing (#1282)
- [Function] Implement REPLACE function @ChobobDev (#1266)
- Implement MD5 Function @seonghun-dev (#1242)
- [AST Builder] Implement ascii, chr function in ast @seonghun-dev (#1244)
- [AST Builder] Implement Geometic Point Type and Geometric Function in AST Builder @seonghun-dev (#1222)
π Features
π Improvements
- Fix parsing of BigDecimal literals with zero fraction part as floats, not integer @zmrdltl (#1416)
- Update docs/ast-builder padding.md code block lang keyword, @panarch (#1436)
- Support StoreMut trait to Optional @seonghun-dev (#1435)
- docs: write docmentation for padding @devgony (#1434)
- test: add test cases for astb-padding @devgony (#1433)
- Upgrade to chrono v0.4.31 and adjust millisecond value in Timestamp Creation @zmrdltl (#1427)
- Remove unnecessary comments in evalaute/function.rs @panarch (#1431)
- write docmentation for character_conversion @devgony (#1428)
- docs: Add
SLICE
function doc @fregataa (#1425) - test: add cases to character_conversion @devgony (#1424)
- docs:Add doc about SPLICE function @jinlee0 (#1423)
- Change store RowIter type from Iterator to Stream @panarch (#1419)
- Reflect Deprecation of
from_utc
in Cratechrono
@zmrdltl (#1415) - Remove eval_to_{int|float..} macro uses in core/../evaluate/function.rs, @panarch (#1361)
- test: write example for ast builder @daengdaengLee (#1259)
- Fix merge conflict in data/value/mod.rs @panarch (#1406)
- chore: implement
ConvertError
, @ever0de (#1401) - refactor: remove implementation of from Value trait for Evaluated @tgsong827 (#1399)
- refactor: update function module's namespacing in ast_builder @tgsong827 (#1398)
- chore: remove
Result
fromast_builder::transaction
return type @ever0de (#1404) - chore: bump rust version to 1.72 @ever0de (#1388)
- chore: add example of convert from payload to custom struct @ever0de (#1379)
- Update Chrono version to 0.4.26, @panarch (#1374)
- Update test-suite Tester::run to return Payload, @panarch (#1373)
- Remove .unwrap() uses in test-suite/ test codes, @panarch (#1372)
- Replace run!, test! and count! macros in test-suite to Tester methods, @panarch (#1368)
- Update coverage.yml gh-action to ignore await only lines, [@panarch](https://g...
v0.14.0 π
We now provide an official documentation website at https://gluesql.org/docs
π Features
π Schemaless data support
GlueSQL now supports creating tables without a schema, allowing for both structured and unstructured data to be stored in the same table.
To create a schemaless table, simply run CREATE TABLE without specifying any columns. For more information on querying schemaless data, please refer to the following link: querying schemaless data
CREATE TABLE Bar;
To insert values,
INSERT INTO Bar VALUES
('{ "name": "ast", "value": 30 }'),
('{ "name": "glue", "rate": 3.0, "list": [1, 2, 3] }'),
Then, selecting values from schemaless table is simple.
SELECT name, rate, list[0] FROM Bar WHERE name = 'glue';
e.g.
CREATE TABLE Names (id INTEGER, name TEXT);
INSERT INTO Names VALUES (1, 'glue'), (2, 'sql');
CREATE TABLE Logs;
INSERT INTO Logs VALUES
('{ "id": 1, "value": 30 }'),
('{ "id": 2, "rate": 3.0, "list": [1, 2, 3] }'),
('{ "id": 3, "rate": 5.0, "value": 100 }');
SELECT * FROM Names JOIN Logs ON Names.id = Logs.id;
/*
| id | list | name | rate | value |
|----|---------|------|------|-------|
| 1 | | glue | | 30 |
| 2 |[1, 2, 3]| sql | 3 | |
*/
π IndexedDB & WebStorage supports in JavaScript package
GlueSQL supports handling in-memory, localStorage, sessionStorage, and even IndexedDB using the same SQL syntax. All you need to know is how to specify the ENGINE
when creating a table.
e.g.
CREATE TABLE Mem (mid INTEGER) ENGINE = memory;
CREATE TABLE Loc (lid INTEGER) ENGINE = localStorage;
CREATE TABLE Ses (sid INTEGER) ENGINE = sessionStorage;
CREATE TABLE Idb (iid INTEGER) ENGINE = indexedDB;
SELECT
mid, lid, sid, iid
FROM Mem
JOIN Loc
JOIN Ses
JOIN Idb;
π Data Types - UINT32
, UINT64
, UINT128
, POINT
and FLOAT32
- implement f32 data type @pythonbrad (#1145)
- Implement geometric
POINT
Type and geometric functions @seonghun-dev (#1048) - Add
UINT32
,UINT64
andUINT128
data types @ChobobDev (#1019) - Add inet datatype @pythonbrad (#1080)
π Functions - APPEND
, PREPEND
, RAND
, FIND_IDX
, INITCAP
and CALC_DISTANCE
- Feat : add calc_distance function @seonghun-dev (#1153)
- Add
PREPEND
function forLIST
data type @seonghun-dev (#1149) - add initcap function @pythonbrad (#1064)
- Implement
FIND_IDX
function @zmrdltl (#1100) - Implement Rand function @pythonbrad (#1063)
- Add Append Function to LIST DataType @seonghun-dev (#1047)
π Store traits
User-level custom function
By implementing both the CustomFunction and CustomFunctionMut traits, users can create, use, and delete user-level custom functions. Although GlueSQL plans to continuously add various functions, users may still find them insufficient. In such cases, users can create their own user-level custom functions to supplement the built-in functions. Additionally, if there are repetitive business logic codes, they can be stored as custom functions.
e.g.
CREATE FUNCTION ADD_ONE (n INT, x INT DEFAULT 1) RETURN n + x;
SELECT ADD_ONE(10) AS test;
DROP FUNCTION ADD_ONE;
- Support user level sql function @pythonbrad (#1095)
Metadata
The Metadata trait is an optional implementation for providing additional metadata support in GlueSQL. GlueSQL does not enforce any specific metadata implementation, allowing custom storage developers to decide which type of metadata, such as create time, modify time, etc., they want to provide.
π Storages
JSON Storage
- Add JsonStorage support to CLI @devgony (#1135)
- Rename
Jsonl
Storage toJson
Storage @devgony (#1128) - Support
JSON
format inJSONL storage
@devgony (#1123) - Support
Jsonl
Storage @devgony (#1053)
Composite Storage
IndexedDB Storage
Web Storage
π Other new features
- Wrap identifiers with double quote (
"
) atto_sql
@devgony (#1130) - Support Values Query at ASTBuilder @devgony (#1041)
- Support
Schema::from_ddl(ddl: &str) -> String
@devgony (#1089) - Support column alias for Table, Derived Table @ding-young (#1065)
- Support
TableFactor::{Derived, Dictionary, Series}
in AstBuilder @devgony (#1007)
π Interface Changes
- Remove Store trait related cfg features, @panarch (#1091)
- Refactor CreateTable.columns from
Vec<ColumnDef>
toOption<Vec<ColumnDef>>
@devgony (#1086) - Remove
MutResult
@panarch (#1073) - Update all store mut trait methods to take &mut self @panarch (#1072)
- Change StoreMut interface to use &mut self, not to take ownership @panarch (#1071)
- Modify default ColumnOption from NOT NULL to NULL @devgony (#997)
π Improvements
- Add a case for insert with source @devgony (#1211)
- Apply workspace inheritance to remaining Cargo.toml in storages/, @panarch (#1181)
- Add nullable, key, default to
GLUE_TABLE_COLUMNS
@devgony (#1177) - Update core to bundle all errors using error module, @panarch (#1178)
- Update global Error enum to display with error module prefix @panarch (#1175)
- fix: typo @ever0de (#1161)
- Move the SCHEMA_PREFIX const into an impl in SledStorage @garypen (#1151)
- Merge evaluate_stateless into evaluate, @panarch (#1132)
- Remove memory-storage dep from JsonStorage/ Cargo.toml @panarch (#1131)
- Simplify JsonlStorage codes @panarch (#1126)
- Bump rust version to 1.68 @ever0de (#1125)
- Keep
Cargo.lock
@ever0de (#1121) - Replace closure to variable in
data/interval
module @ever0de (#1118) - Add
f64
support todata::Key
@panarch (#1114) - Add Ord impl for Key, @panarch (#1110)
- join_expr when in_subquery, exists expr in join constraint @ding-young ([#1...
v0.13.1
π CLI - Data migration support
Dump whole schemas and data by generating SQL using --dump {PATH}
option
$ gluesql --path ~/glue_data --dump ./dump.sql
-- dump.sql
CREATE TABLE Item (id INT, name TEXT);
CREATE INDEX item_id ON Item (id);
..
INSERT INTO Item VALUES (1, 'Foo'), (2, 'Bar') ..
..
Import database
$ gluesql --path ~/new_data --execute ./dump.sql
What's Changed
- Support the way to migrate whole databse with
--dump {PATH}
argument (+to_ddl()
) by @devgony in #977 - Replace double quote to single quote by @devgony in #988
- Replace
TryFrom for AstLiteral
=>TryFrom for Expr
, add more test to dump by @devgony in #990 - Bump cli, core, pkg/rust and test-suite versions to v0.13.1 by @panarch in #991
Full Changelog: v0.13.0...v0.13.1
v0.13.0 π
π Breaking Changes
π AST Builder
AST Builder is now ready to be used!
GlueSQL AST builder provides iterator chaining experience to manipulate data which is similar to array chaining methods or DataFrame syntax.
For someone who is already familiar with SQL, then there would be almost no extra learning cost to use GlueSQL AST builder.
AST builder accepts various sets of params - not only the expression built by its own expr builder, but also it even accepts raw SQL text and prebuilt ASTs.
e.g.
table("Item")
.select()
.join("Category")
.on(col("Category.id").eq("Item.category_id"))
.group_by("Item.category_id")
.having("SUM(Item.price) > 80")
.project("Category.name AS category")
.project("SUM(Item.price) AS sum_price")
.execute(glue)
.await;
category | sum_price |
---|---|
Meat | 90 |
Drink | 85 |
Usage code examples
SELECT queries
INSERT queries
UPDATE queries
DELETE queries
Related PRs (features)
- Implement hash join support to AST builder @panarch (#916)
- [AST-Builder] Impl Case @ding-young (#910)
- [AST] Support
ArrayIndex
Expr @ding-young (#880) - Implement AST builder execute function @panarch (#879)
- [Ast Builder] Implement join expression in select statement @seonghun-dev (#803)
- [AST] Implement to_sql func for OrderByExpr @CEOJINSUNG (#812)
- [AST Builder] Implement to_date and let format function to format date data type @ChobobDev (#858)
- [AST Builder] Implement Lower function @ChobobDev (#853)
- Implement order by ast builder @24seconds (#841)
- [AST builder] Implement To_date and To_timestamp function @ChobobDev (#838)
- [AST Builder] Implement format function @ChobobDev (#836)
- [AST builder] Implement Insert statement @kim-seo-hyun (#802)
- [AST Builder] Implement Alter table statement @ding-young (#813)
- [AST-Builder] Create Table Statement @ding-young (#784)
- [AST Builder] Implement EXISTS Expression @CEOJINSUNG (#790)
- [AST Builder] Implement update Expression @seonghun-dev (#720)
- [AST Builder] Implement Div, Mod Function @seonghun-dev (#760)
Related PRs (improvements)
- Add AST builder integration tests of SELECT, UPDATE, INSERT and DELET⦠@panarch (#955)
- Update AST builder cast function unit test @zmrdltl (#957)
- Expose AST builder unary_op methods to public, @panarch (#956)
- Rename AST builder ExprNode::not to ExprNode::negate @sa1 (#953)
- Add missing select nodes to ExprNode::InList and QueryNode in AST builder @panarch (#934)
- Simplify ast_builder/ QueryNode codes using decl macro @panarch (#932)
- Add from ProjectNode & QueryNode for InListNode in AST builder, @panarch (#925)
- Update ast-builder function expr params to use
Into<..Node>
@panarch (#926) - Update AST builder between & hash_executor to accept different param β¦ @panarch (#923)
- Add ExprNode::subquery, @panarch (#922)
- Add AST builder join nodes to query node conversion support @panarch (#921)
- Add setting table_alias support to AST builder table init function @panarch (#920)
- [AST Builder] Combine in_list and in_subquery into in_list @CEOJINSUNG (#808)
- [AST-Builder] change error message in test functions @ding-young (#800)
- Reformat : change ast builder function format @seonghun-dev (#796)
π Features
π New metadata tables - GLUE_TABLES
, GLUE_TABLE_COLUMNS
and GLUE_INDEXES
gluesql> SELECT * FROM GLUE_TABLES;
TABLE_NAME |
---|
Bar |
Foo |
gluesql> SELECT * FROM GLUE_TABLE_COLUMNS;
TABLE_NAME | COLUMN_NAME | COLUMN_ID |
---|---|---|
Bar | id | 1 |
Bar | name | 2 |
Bar | type | 3 |
Foo | id | 1 |
Foo | name | 2 |
gluesql> SELECT * FROM GLUE_INDEXES;
TABLE_NAME | INDEX_NAME | ORDER | EXPRESSION | UNIQUENESS |
---|---|---|---|---|
Foo | PRIMARY | BOTH | id | TRUE |
Foo | Foo_id_1 | BOTH | id + 1 | FALSE |
Foo | Foo_name_concat | BOTH | name + "_" | FALSE |
- Add support
GLUE_INDEXES
reserved table which provides all index info @devgony (#935) - Support Dictionary(Schema) view @devgony (#869)
π§ ORDER BY enhancements
Support ORDER BY ALIAS
clause like below
SELECT column_name AS alias_name FROM Table ORDER BY alias_name DESC
- Currently, it throws
[error] value not found: alias_name
Original column_name
is still available at ORDER BY clause though SELECT clause uses alias_name
SELECT column_name AS alias_name FROM Table ORDER BY column_name DESC
Support ORDER BY COLUMN_INDEX
SELECT alpha, beta FROM Table ORDER BY 1 DESC
1
means the column_index which is first columnalpha
Support ORDER BY
clause in VALUES list
gluesql> VALUES (1, 'a'), (2, 'b') ORDER BY column1 DESC;
column1 | column2
---------+---------
2 | b
1 | a
Related PRs
- Support ORDER BY
ALIAS
andCOLUMN_INDEX
@devgony (#805) - Support
ORDER BY
clause inVALUES list
@devgony (#730)
π ToSql
trait for AST which provides AST to SQL text conversion for easier debugging
e.g.
ToSql::to_sql
from the below AST returns this simple SQL text.
- Generated SQL text
CREATE TABLE Foo (id INT, num INT NULL, name TEXT);
- Input AST
Statement::CreateTable {
if_not_exists: false,
name: "Foo".into(),
columns: vec![
ColumnDef {
name: "id".to_owned(),
data_type: DataType::Int,
options: vec![]
},
ColumnDef {
name: "num".to_owned(),
data_type: DataType::Int,
options: vec![ColumnOptionDef {
name: None,
option: ColumnOption::Null
}]
},
ColumnDef {
name: "name".to_owned(),
data_type: DataType::Text,
options: vec![]
}
],
source: None
}
.to_sql()
Related PRs
- Implement to_sql func for SetExpr, Join @CEOJINSUNG (#898)
- [AST] Implement to_sql func for Query, SetExpr, Select, SelectItem, TableWithJoins, IndexItem, TableFactor, TableAlias @CEOJINSUNG (#860)
- [AST] To_sql for CREATE TABLE, ALTER TABLE @ding-young (#807)
- [AST] to_sql for Function @ding-young (#931)
- [AST] to_sql for STATEMENTS @ding-young (#824)
- [AST] Implement to_sql for INSERT, UPDATE, DELETE @ding-young (#821)
π³ New datatype and functions
New datatype - UINT8
New functions - ASCII
, CHR
, POSITION
, TO_DATE
, TO_TIMESTAMP
and FORMAT
- Implement ASCII, Chr functions @seonghun-dev (#881)
- Implement function
POSITION
@zmrdltl (#862) - Implement str_position function under enum Value @zmrdltl (#875)
- [Function] Implement
TO_TIME
function and letFORMAT
getTIME
data type @ChobobDev (#842) - [Function] Implement
TO_DATE
andTO_TIMESTAMP
function @ChobobDev (#833) - [Function] Implement
FORMAT
function @ChobobDev (#818)
π CLI enhancements
Support .edit {fileName|None}
in CLI @devgony (#871)
- Open temporary editor with last SQL
$> cargo run
gluesql> .run
[error] Nothing in SQL history to run.
gluesql> SELECT 1, 'a', true
1 | 'a' | true |
---|---|---|
1 | a | TRUE |
gluesql> .edit
=> open Editor with last command on temporary file like /tmp/Glue_****.sql
-- modify in editor
SELECT 1, 'a', true, 2, 'b'
If you want to fix editor type, run below command on OS
# (optional)
$> export EDITOR=vi
gluesql> .run
1 | 'a' | true | 2 | 'b' |
---|---|---|---|---|
1 | a | TRUE | 2 | b |
- Open editor with physical file
gluesql> .edit foo.sql
-- modify in editor
SELECT 1 AS no, 'In physical file' AS name
gluesql> .execute foo.sql
no | name |
---|---|
1 | In physical file |
New CLI print options
gluesql> .set tabular OFF
gluesql> .set colsep ,
gluesql> .set colwrap '
gluesql> .set heading OFF
gluesql> VALUES (1, 'a', true), (2, 'b', false)
'1','a','true'
'2','b','false'
Change default print style to markdown
Set markdown as default print style like below
gluesql> SELECT * FROM (VALUES (1, 'a', true), (2, 'b', false)) AS Sub;
column1 | column2 | column3 |
---|---|---|
1 | a | TRUE |
2 | b | FALSE |
(pasted from gluesql directly) |
π‘ Improvements
Aggregation
- Support
Expr::Case
in aggregate module @ever0de (#945) - Update aggregate functions to support
Expr
@zmrdltl (#749)
sqlparser-rs
upgrades
- Upgrade sqlparser-rs to v0.25 @panarch (#907)
- Upgrade sqlparser-rs to v0.24, migrate Interval from Literal to Expr @panarch (#904)
- Upgrade sqlparser-rs to v0.22 @panarch (#819)
- Migrate sqlparser-rs from 0.18 to 0.19, @panarch (#817)
Tests
v0.12.0 π
π Breaking Changes
β‘ Store trait changes
- Store traits no longer require generic
T
// v0.11
pub trait Store<T: Debug> { .. }
pub trait StoreMut<T: Debug> where Self: Sized { .. }
pub trait Index<T: Debug> { .. }
pub trait IndexMut<T: Debug> where Self: Sized { .. }
// v0.12
pub trait Store { .. }
pub trait StoreMut where Self: Sized { .. }
pub trait Index { .. }
pub trait IndexMut where Self: Sized { .. }
Related PRs
- Remove generic T from Store, StoreMut and Index traits, @panarch (#589)
- Replace SledStorage generic key T from IVec to data::Key @panarch (#588)
- Replace MemoryStorage Key to core::data::Key, @panarch (#577)
Store::fetch_data
is newly added,Store
trait now requires three methods to implement
pub trait Store {
async fn fetch_schema(&self, table_name: &str) -> Result<Option<Schema>>;
async fn fetch_data(&self, table_name: &str, key: &Key) -> Result<Option<Row>>;
async fn scan_data(&self, table_name: &str) -> Result<RowIter>;
}
Related PR
StoreMut
trait method renamings -insert_data -> append_data
andupdate_data -> insert_data
pub trait StoreMut where Self: Sized {
...
async fn append_data(..) -> ..;
async fn insert_data(..) -> ..;
}
Related PR
π PRIMARY KEY support
GlueSQL now supports PRIMARY KEY!
CREATE TABLE Allegro (
id INTEGER PRIMARY KEY,
name TEXT,
);
more info - test-suite/primary_key
- Implement primary key support, @panarch (#687)
- Update
Expr::CompoundIdentifier
to have more accurate data format @devgony (#770) - Update SledStorage key.rs to use IVec::from_iter, not IVec::from @panarch (#765)
- Update SledStorage scan_(indexed)_data key not to contain table prefix, @panarch (#762)
- Update sled-storage::update_data not to return error on not-existing β¦ @panarch (#717)
β New queries support
Select query without table & support SERIES(N)
SELECT 1;
SELECT N FROM SERIES(10);
more info - test-suite/series
VALUES
support
VALUES (1, 'a'), (2, 'b');
VALUES (1, 'a'), (2, 'b') LIMIT 1;
VALUES (1, 'a'), (2, 'b') LIMIT 1 OFFSET 1;
SELECT * FROM (VALUES (1, 'a'), (2, 'b')) AS Derived;
SELECT * FROM (VALUES (1, 'a'), (2, 'b')) AS Derived(id, name);
CREATE TABLE TableFromValues AS VALUES (1, 'a', True, Null, Null), (2, 'b', False, 3, Null)
more info - test-suite/values
- Support
Derived VALUES
@devgony (#731) - Support CTAV(Create Table As Values) @devgony (#704)
- Enhance
Values List
to validate column type @devgony (#659) - Support
VALUES List
inselect
module @devgony (#648)
Inline view
SELECT * FROM (SELECT COUNT(*) FROM InnerTable) AS InlineView
more info - test-suite/inline_view
π New storage - SharedMemoryStorage
Non-persistent storage engine which works in multi-threaded environment
π [Alpha Phase] AST Builder
Now, SQL is not the only language supported by GlueSQL!
AST Builder generates GlueSQL AST directly from Rust codes.
e.g.
let actual = table("Bar")
.select()
.filter(col("id").is_null())
.group_by("id, (a + name)")
.build();
let expected = "
SELECT * FROM Bar
WHERE id IS NULL
GROUP BY id, (a + name)
";
let actual = table("Bar")
.select()
.group_by("city")
.project("city, COUNT(name) as num")
.build();
let expected = "
SELECT
city, COUNT(name) as num
FROM Bar
GROUP BY city
";
let actual = table("Person")
.delete()
.filter(col("name").is_null())
.build();
let expected = "DELETE FROM Person WHERE name IS NULL";
more info - core/ AST Builder
Related PRs
- Add in_subquery test case using QueryNode @CEOJINSUNG (#781)
- Add QueryNode enum and test_query function @CEOJINSUNG (#777)
- feat:[#756] implement Ltrim and Rtrim function @ChobobDev (#763)
- [AST Builder] Implement substr Funciton @seonghun-dev (#758)
- [AST Builder] Implement Exp Funciton @seonghun-dev (#753)
- [AST Builder] Implement Lpad, Rpad Funciton @seonghun-dev (#752)
- Implement cast function in AST builder @kim-seo-hyun (#759)
- [AST Builder] Implement Concat Funciton @seonghun-dev (#750)
- [AST Builder] Implement radians, degrees Funciton @seonghun-dev (#755)
- [AST Builder] Implement Repeat Funciton @seonghun-dev (#742)
- [AST Builder] Implement GenerateUuid Funciton @seonghun-dev (#740)
- feat:[#732] Implement
Gcd
andLcm
function toast_builder
@ChobobDev (#734) - feat:[#728] Implement
Log
function toast_builder
@ChobobDev (#729) - feat:[#725] Implement
Power
andSqrt
function toast_builder
@ChobobDev (#726) - [AST Builder] Update FunctionNode structure @zmrdltl (#723)
- [AST Builder] Implement InSubquery and QueryNode @CEOJINSUNG (#721)
- [AST Builder] Implement Sign function @kim-seo-hyun (#711)
- [AST Builder] Implement Transaction Statements @ding-young (#709)
- [AST Builder] Implement AST builder InList function @CEOJINSUNG (#697)
- [AST Builder] Implement Index Expr @seonghun-dev (#673)
- [AST Builder] Implement drop_table Expr @seonghun-dev (#695)
- implement now function in ast builder @kim-seo-hyun (#692)
- [AST Builder] Implement show_columns Expr @seonghun-dev (#689)
- Implement AST-builder between expression function @CEOJINSUNG (#672)
- feat(ast_build): implement binary operations (modulo, like, ilike, not_like, not_ilike) @bugoverdose (#686)
- refactor(ast_build): reorder binary_op functions and tests @bugoverdose (#681)
- Implement
ln
in ast_builder @gimwonbae (#680) - Implement unary_op (+, -, NOT, !) in ast_builder @ding-young (#669)
- Implement AST-builder extract functions @CEOJINSUNG (#666)
- Implement round function in ast_builder @ding-young (#657)
- [AST Builder] Implement Agggregate function
COUNT
@zmrdltl (#656) - Add more expression support to project, @panarch (#655)
- Implement ast_builder binary::gte<e&or @woojinnn (#654)
- Enhance SelectNode::filter @woojinnn (#653)
- Implement AST-builder log2, log10 function @CEOJINSUNG (#650)
- implement ceil function @jaeyoung0909 (#645)
- feat(ast_builder): Add Agggregate functions @zmrdltl (#635)
- Implement add reverse func in ast_builder @seonghun-dev (#637)
- implement ast_builder/expr/function/{Left, Right} @woojinnn (#626)
- Implements trigonometric functions in ast_builder @nyeong (#627)
- feat(ast_build): implement upper function @ChobobDev (#621)
- feat(ast_build): implement ifnull function @bugoverdose (#620)
- Add floor func in ast_builder @yujong-lee (#616)
- Implement query builder base (AST builder) @panarch (#613)
π Features
CLI updates
- Support
.spool FilePath
command in CLI @devgony (#748) - Support
.columns TABLE
command in CLI @devgony (#736)
New data types
- Add INT(16) data type @yujong-lee (#632)
- Add data type i32 @bearney74 (#608)
- Add BYTEA data type support @panarch (#586)
- Add i128 (int128) data type @bearney74 (#563)
New aggregate function - STDEV
& VARIANCE
- Add
STDEV
aggregate funtion @zmrdltl (#684) - Support
VARIANCE
aggregate function & update aggregate test @zmrdltl (#598) - [Data] Add function
sqrt
for enumValue
@zmrdltl (#675)
New function - IFNULL
- Implement IFNull function @bearney74 (#569)
New statement - SHOW INDEXES FROM {table}
- Add Description column to "show index from table" output @bearney74 (#600)
- Show indexes from table... (resolves issue #520) @bearney74 (#551)
ToSql
- Implement
ToSql
trait which displays AST as SQL text format @bearney74 (#554)
π‘ Improvements
GitHub Action related
- Update rust.yml GitHub Action to handle sled_transaction_timeout_* te⦠@panarch (#772)
- Remove clippy warning in mac os @24seconds (#715)
- Run github action job parallel @24seconds (#699)
- Update coverage action to use grcov & Coveralls @panarch (#647)
- Simplify github rust action - Run tests & Run examples, @panarch (#594)
Test Suite refactoring
- [Test Suite] Merge use crates into one @zmrdltl (#788)
- [Test Suite] Refactor
basic
@zmrdltl (#785) - [Test Suite] delete unneccesary keyword
vec!
,iter()
@zmrdltl (#775) - [Test Suite] Refactor
arithmetic
@zmrdltl (#773) - [Test Suite] Refactor
aggregate
@zmrdltl (#771)
rust-toolchain & sqlparser-rs migration
- chore:[#700] rust version update @ChobobDev (#724)
- upgrade to Sqlparser 0.18 @bearney74 (#612)
- upgrade to rust 1.61 @bearney74 (#564)
- Update rusttoolchain version to 1.60 and sqlparser-rs to 0.17 @bearney74 (#557)
Other improvements
- Add Update integration test @seonghun-dev (#738)
- Replace bool::then to bool::then_some @panarch (#727)
- import only where you use
Duration
@ever0de (#722) - Remove unnecessary
Box
@ever0de (#716) - Add DROP TABLE multi object test case in integration test @seonghun-dev (#706)
- Mark flaky test using target_os cfg @24seconds (#702)
- Update aggregate structure @zmrdltl (#698)
- Convert
TryInto
traits intoTryFrom
@nyeong (#682) - Add SharedMemoryStorage to the src documentation comment @kim-seo-hyun (#664)
- Add missing test ca...
v0.11.0 π
π Breaking Changes
π GlueSQL.js
JavaScript interface for both web browsers and Node.js
GlueSQL works again in web browsers!
e.g.
import { gluesql } from 'gluesql';
const db = await gluesql();
db.query(`
CREATE TABLE User (id INTEGER, name TEXT);
INSERT INTO User VALUES (1, "Hello"), (2, "World");
`);
const [{ rows }] = await db.query('SELECT * FROM User;');
console.log(rows);
More Info
Related PRs
- Implement TryFrom between Value and serde_json::Value @panarch (#501)
- GlueSQL.js - support both web browsers and Node.js @panarch (#512)
- Fix gluesql-js/package.json to publish files correctly, @panarch (#543)
π Features
New functions - ABS
, SIGN
and CONCAT
SHOW COLUMNS
SledStorage
export and import
CLI - SQL file read-and-execute
- Add support SQL file read-and-execute @pythonbrad (#496)
Other new features
- Implement cast to decimal @Earney (#529)
- More numeric binary operations with Decimal @Earney (#530)
- Implement hash join executor support @panarch (#494)
- Feature implementation - Unary Factorial operation for (unsigned)
INT8
type @MRGRAVITY817 (#477) - Support
limit
,offset
clause in Insert into values ~ @devgony (#484) - Update evaluate_stateless to support all existing SQL functions, @panarch (#471)
π‘ Improvements
sqlparser-rs
migration
- Migrate code from sqlparser v14 to v16 @Earney (#542)
- Migrate sqlparser-rs version from v0.13 to v0.14, @panarch (#541)
- Bump up
sqlparser
crate version from 0.11 to 0.13 @MRGRAVITY817 (#479)
Unit test
- Add unit tests to data/value/into.rs module @pythonbrad (#518)
- Add unit tests for data/value/literal.rs @pythonbrad (#497)
Error handling
- Scalar subquery should throw Error when more than one row returned @devgony (#537)
- Apply better names to numeric binary operation error names #424 @Earney (#534)
- cast 255 as int8, should return an error, but returns 127 instead (resolves issue #545) @Earney (#546)
Other improvements
- Fix typo (Tripple to Triple) @ever0de (#539)
- Minor improvements @ever0de (#507)
- Bump up toolchain ver. from 1.58 -> 1.59 @MRGRAVITY817 (#502)
- Apply nit code improvements to core/ executor/join module @panarch (#498)
- Simplify lifetime uses in data/literal binary operators @panarch (#495)
- Add macos attributes in gitignore @ever0de (#492)
- Fix typo @ever0de (#490)
- Remove unused generic in
IndexMut
@ever0de (#488) - Remove
Debug
macro from the generic requirements for key @ever0de (#486) - Bump rust version 1.58 @ever0de (#487)
- Update Join::apply to take the whole table(rows) as a stream iterator @MRGRAVITY817 (#472)
π Bug Fixes
- Fix CLI --execute {file}.sql option to support CRLF line break, @panarch (#519)
- Fix value/ big_endian module to handle negative integers correctly, @panarch (#505)
π New Contributors
- @pythonbrad made their first contribution in #496
- @Earney made their first contribution in #510
Full Changelog: v0.10.2...v0.11.0