Commit Graph
23 Commits
Author SHA1 Message Date
davidmezzetti 5cba72c88a Update pylintrc file and remove warning overrides for new limits 2026-09-29 07:11:03 -04:00
Amir Fathi 72f9ca7605 Fix Cluster combining avg() as an unweighted mean of shard averages (#1237) 2026-09-14 10:18:52 -04:00
davidmezzetti d59c88424d Code cleanup 2026-07-21 12:59:57 -04:00
Andrew Chen 46467a3453 Raise SQLError on empty select expressions and a dangling AS (#1147) 2026-07-21 12:24:12 -04:00
davidmezzetti fcfd340ff1 Cleanup tests 2026-07-21 12:18:35 -04:00
Andrew Chen d6f696d795 Fix Aggregate IndexError on a SQL query that matched nothing across shards (#1139) 2026-07-21 11:19:28 -04:00
davidmezzetti aa0a8cfc32 Cleanup code from #1125 2026-07-02 10:37:57 -04:00
Sanjay Santhanam 796c5bb0a8 Raise SQLError on unterminated bracket, function and similar clauses
The token consumer loops in Expression.bracket(), Expression.function() and
Expression.similar() read the next token with next(iterator, (None, None)) but
never checked for the end-of-stream sentinel. When a clause was left
unterminated (e.g. "select [a from txtai", "select func(a from txtai" or
"select * from txtai where similar('abc'"), the iterator was exhausted and the
code indexed tokens[None], raising a cryptic

    TypeError: list indices must be integers or slices, not NoneType

instead of the SQLError that the database layer documents and callers catch for
invalid SQL. The parse step runs before the query is handed to the database, so
this TypeError escaped the SQLError wrapping in Database.execute().

Add Expression.advance(), a small helper that wraps next() and raises SQLError
when the token stream is exhausted mid-clause, and route the three delimited
consumer loops through it. Auto-closing the clause instead was rejected because
it would silently reinterpret malformed input (e.g. "select [a" would become the
valid column "a"), masking the user error. This mirrors the existing None-guard
convention already used in Expression.compound().

Behavior on valid queries is unchanged (advance() only diverges from the old
code path when the iterator is empty). Adds testUnterminated covering
unterminated bracket, function and similar clauses.
2026-07-01 23:11:21 -07:00
Rin 5a66065b34 Escape single quotes in dynamic column names to prevent SQL injection (#1026) 2026-02-15 10:50:45 -05:00
davidmezzetti b30a96d9c2 Add WAL option for SQLite, closes #488 2023-06-14 13:06:10 -04:00
davidmezzetti d4dc811f18 Add DuckDB support, closes #462 2023-04-18 17:23:27 -04:00
davidmezzetti 5aeefc3ab8 Update tests 2023-02-19 13:49:13 -05:00
davidmezzetti d92a076c06 Fix issue with ORDER BY case sensitivity, closes #405 2023-01-09 16:52:02 -05:00
davidmezzetti 096927a133 Fix issue with similar and bracket SQL expressions embedded in functions, closes #382 2022-11-19 11:45:29 -05:00
davidmezzetti 1f99694f76 Fix issue with select distinct, closes #379 2022-11-19 10:44:55 -05:00
davidmezzetti 60d1c7c2d7 Add SQL expression columns, closes #338 2022-09-14 11:14:50 -04:00
davidmezzetti e444d771ee Add sql offset clause support, closes #293 2022-06-13 10:16:48 -04:00
davidmezzetti 47b6b07db3 Rename SQLException to SQLError, closes #232 2022-03-01 09:03:55 -05:00
davidmezzetti 03b97cbc52 Update tests 2022-02-10 08:16:38 -05:00
davidmezzetti 5ff161f31f Add support for user defined column aliases and identifier/expression bracket clauses, closes #186 and closes #187 2021-12-26 20:05:24 -05:00
davidmezzetti b14d8769dd Update test method docs for consistency 2021-12-22 06:44:49 -05:00
davidmezzetti f84ed38c1b Consistently name embeddings id fields, closes #178 2021-12-14 14:34:05 -05:00
davidmezzetti 345d092fab Initial version of storing document content (closes #168), inserting dictionaries (closes #169) and SQL query support (closes #170) 2021-12-13 19:50:55 -05:00