Commit graph

137 commits

Author SHA1 Message Date
AarDG10
8560db8bc1 feat(custom): add separator support for Group_concat in Mariadb 2026-03-29 17:45:46 +05:30
Diptanil Saha
a93b84df3c
fix(query_builder): added validation to check DocType name (#36878)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2026-02-09 15:24:58 +05:30
Akhil Narang
7322fca429
fix(query_builder): patch Function.get_sql explicitly
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2026-01-28 18:55:40 +05:30
Aarol D'Souza
59b440cb28
fix(search): make QB DB-Aware when using Locate (#35796)
* fix: make QB DB-Aware when choosing Locate

* fix(test): adjust test to check smarter qb choice based on db
2026-01-12 12:06:28 +05:30
Akhil Narang
c7f5ea837a
feat: implement field masking for query builder (#35230)
* feat: implement field masking for query builder

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* fix: add series and sessions to "core doctypes" list

This is so that we don't try to query their meta
This should also resolve #35030

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-12-16 12:08:13 +05:30
Sagar Vora
87b1e15a31 fix: remove double-quoting in Locate and Ifnull functions
The custom implementations were calling .get_sql() on pypika terms,
then passing the already-quoted string to super().__init__() which
quoted it again. This broke queries with quotes in values.

Fix: Let pypika's base classes handle the quoting by passing terms
through unchanged. Ifnull now just aliases pypika's IfNull directly.
2025-12-02 02:08:03 +05:30
Akhil Narang
978edeaa1d
feat: add in some functions
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-11-19 21:15:58 +05:30
Rohit Waghchaure
3ec948239f feat: group by week dates in qb 2025-08-15 15:37:36 +05:30
Sagar Vora
0fa1d12228 perf: minor improvements to execute_query 2025-05-30 11:24:52 +05:30
aayush7908
15d331685a refactor: simplify database type mapping in query builder 2025-05-05 18:03:09 +05:30
Akhil Narang
ad32216040
fix: support sqlite
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:16 +05:30
Akhil Narang
0b5e245507
feat: init sqlite
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:16 +05:30
Sagar Vora
09de71cb96 perf: define __slots__ in NamedParameterWrapper 2025-03-16 15:39:59 +05:30
Sagar Vora
ab98d3716f perf: optimize query building code 2025-03-15 10:29:26 +05:30
Sagar Vora
20220ef894
fix: avoid one time setup (#31650) 2025-03-12 12:44:19 +05:30
Ankush Menat
5de5e25df6
fix: datetime comparison in QB (#26364)
closes https://github.com/frappe/frappe/issues/26363
2024-05-09 10:19:27 +00:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Ankush Menat
3aa7fd77ed
fix: patch QB before setup_module_map (#24981)
This function if cache isn't available CAN result in a DB query, this
will cause cold starts to fail because QB is not yet patched.
2024-02-21 09:57:50 +00:00
Ankush Menat
0a886b7ca8 perf: defer imports during CLI 2024-02-19 18:10:07 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Ankush Menat
f8743d1cfb fix: support running QB union queries
closes https://github.com/frappe/frappe/issues/15609
2024-02-05 16:45:04 +05:30
Ankush Menat
a69b779715 fix: Make as_iterator work when there are no child queries
QB child queries feature assumes that result will be list, at least in
case of no chlid queries we can make it work. (this is most common case anyway)
2024-01-15 13:05:35 +05:30
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Ankush Menat
57699a54b1
fix: Show server script name in traceback (#23676)
* fix: Show server script name in traceback

* chore: typo

Co-authored-by: Sagar Vora <sagar@resilient.tech>

---------

Co-authored-by: Sagar Vora <sagar@resilient.tech>
2023-12-08 15:01:13 +05:30
Ankush Menat
adf30693a9 ci: update pyupgrade 2023-07-14 14:24:08 +05:30
David Arnold
6b2bb9a2ab
fix: add env overrides for service orchestration (#21577)
This avoids having to manipulate config files in brittle bash
entrypoints that need to react to dynamic service discovery.

This significantly improves the operability of various bench sites.
2023-07-14 11:39:01 +05:30
Ankush Menat
8a37d6d278
perf: reduce memory usage of background processes (#21467)
* perf: defer translation.py imports

This indirectly imports babel which isn't really required most of the
time.

* perf: defer gzip import

* perf: move validate_and_sanitize_search_inputs

This causes all sorts of indirect imports and increases memory usage

* perf: defer requests module imports

* perf: defer system settings import

* perf: defer LOG_DOCTYPES import

Causes many indirect imports

* perf: defer update_site_config

* perf: defer notifications import

* perf: remove unused import

* perf: defer safe exec import

* test: memory usage overhead
2023-06-23 12:51:45 +05:30
Sagar Sharma
a43ad15eab feat: Truncate QB function 2023-05-26 14:03:47 +05:30
Sagar Sharma
3f0b03c808 feat: Round QB function 2023-05-26 14:03:12 +05:30
Faris Ansari
c4bb732eaa fix: use dict syntax instead of string 2023-05-08 18:55:11 +05:30
Faris Ansari
41d7563aff feat: child_field[] syntax sugar for qb
- fetch child table rows in qb.get_query
- runs one query each for each child field
2023-05-08 18:55:11 +05:30
Rutwik Hiwalkar
69b22f3af2
chore: add ascending order to querybuilder (#20471) 2023-03-28 00:01:42 +05:30
Faris Ansari
fe13108eec fix: refactor
- move operator map in separate file
- remove unnecessary code
- organize functions
2023-01-10 16:15:33 +05:30
Faris Ansari
f982439eb9 fix: pass fields explicitly
- to prevent addition of default `name` field
- also, add fields only if it is a select query
2023-01-09 16:43:44 +05:30
Faris Ansari
be654eaa60
Merge branch 'develop' into refactor-qb-engine 2023-01-09 15:23:20 +05:30
Ankush Menat
075a2d778e feat: UnixTimestamp QB function 2023-01-09 12:05:52 +05:30
Faris Ansari
726fcfdb79 refactor: qb.engine
- simplify
- qb.engine.get_query -> qb.get_query
- qb.engine.build_conditions -> qb.get_query
2022-12-25 23:19:11 +05:30
Ankush Menat
b11793ab02 fix: set filename explicitly for safe_exec 2022-12-07 16:34:27 +05:30
Aradhya Tripathi
68e9fa639e
docs: Added query_builder docs (#19086)
* docs: Added query_builder docs

* docs: Added future works
2022-12-05 16:48:12 +05:30
Ritwik Puri
ba25e97d4e
Merge pull request #18756 from ankush/qb_simpler
refactor: qb builder class identification
2022-11-04 17:26:57 +05:30
Ankush Menat
f0197d35d6 refactor: qb builder class identification 2022-11-04 15:42:26 +05:30
Aradhya
8b73108270 feat: added PseudoColumnMapper for postgres support 2022-11-03 20:43:24 +05:30
mergify[bot]
002b27dbdd
fix: pypika does not parse datetime.time (backport #18184) (#18205)
* fix: pypika does not parse datetime.time

(cherry picked from commit b8f5a4304cccda954822cfe69d4805a18d9f07a7)

* fix: style - imports sort order fixed

(cherry picked from commit c3562c643ab9bff38d230202675d8ce1ae190912)

* test: add test for query builder parsing datetime.time

(cherry picked from commit 99889c270199da4b26b0d3858ae0f0a416d49d90)

* fix: format_time instead of format_datetime, test was failing!

(cherry picked from commit 5d697a22ac8cb98c8f8f44b3f99c57b932c5223c)

* fix(style): linter issues

(cherry picked from commit e231e1b0eadf63e84c9f81cfed9e2926e086fc44)

* test: add test for postgres

(cherry picked from commit 695591c43af9672cb83ce856a46c97e0bddfa9c3)

* fix: converting datepart and timepart to strings for Combinedatetime

(cherry picked from commit 1ebda943a607688bfb3db9fb42c80723a9050973)

* fix: style, linter issues

(cherry picked from commit c01262ad02b8831fdb0c5332b6973499e8adf6ad)

Co-authored-by: Anoop Kurungadam <anoop@earthianslive.com>
Co-authored-by: Aradhya <aradhyatripathi51@gmail.com>
2022-09-23 15:46:31 +05:30
Aradhya
85d1e41738 fix: fixed join query from fields 2022-08-10 23:42:01 +05:30
Aradhya
6c905233c5 feat: Added support for string filters in query 2022-07-28 23:55:58 +05:30
Aradhya
1ae3b7f16b feat: Added support for fields in Locate 2022-07-27 21:22:38 +05:30
Gavin D'souza
1ccdad811a Merge branch 'develop' of github.com:frappe/frappe into mariadb-client-refactor 2022-07-19 16:23:24 +05:30
Aradhya
c97562b736 feat: Added Timestamp support 2022-07-08 21:05:42 +05:30
Gavin D'souza
71b5c77e6e Merge branch 'develop' of github.com:frappe/frappe into mariadb-client-refactor 2022-07-05 14:55:02 +05:30
Aradhya
88faad6409 fix: pyupgrade 2022-07-01 13:30:18 +05:30