Commit graph

2628 commits

Author SHA1 Message Date
Akhil Narang
33dbf97db2
fix(document): don't try to overwrite name if a string is already set
This allows us to pass `name` in via API when creating documents.

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-05-05 12:24:58 +05:30
Sagar Vora
f242b34ef2
Merge pull request #32379 from sagarvora/fix-get-onload
fix(Document): improve `__onload` implementation
2025-05-03 15:14:24 +00:00
Sagar Vora
f93b87ddd8 fix(Document): improve __onload implementation 2025-05-03 20:35:52 +05:30
Ankush Menat
dbb1fcba99 perf: avoid ifnull for is set and is not set 2025-05-02 12:35:58 +05:30
Ankush Menat
6d32ffcc6c perf: optimize != operator when field can be null 2025-05-02 12:11:27 +05:30
Ankush Menat
e0f63a928f fix: avoid bad default of flt on string types
🤦 this whole thing needs a refactor, fixing all bugs first to
ensure we don't screw up something in process
2025-05-02 12:00:36 +05:30
Ankush Menat
23ffdc87ae perf: Split ifnull into two conditions
This produces better query plan with index intersection using 2
conditions instead of fulltable scan on dumb condition

TODO: LOTS OF TESTS
2025-05-02 11:17:53 +05:30
Ankush Menat
c317462379 fix(DX): Better formatted SQL queries from DB Query
Avoid unnecessary tabs, thought of using dedent but unnecessary overhead
for small stylistic benefit inside code vs. stylistic benefit in logs.
2025-05-02 11:10:05 +05:30
Ankush Menat
42f1d1b460
fix(db_query): double-escaped value (#32376) 2025-05-02 11:09:11 +05:30
Ankush Menat
2dfb96f91c
fix: handle snapshot isolation errors better (#32318)
* fix: Avoid Snapshot violation

- Main thread created and "read" user
- Other thread modified something
- Main thread wants to delete or "write" to same row.

This violates snapshot isolation.

* fix: treat snapshot violation as deadlock for now

* test: handle snapshot violations
2025-04-28 06:18:38 +00:00
Corentin Forler
6180622275
chore: Fix typo in comment 2025-04-26 10:01:50 +02:00
Ankush Menat
dcb476c990
perf: cast dynamic links while filtering (#32294)
lessen impact of https://github.com/frappe/frappe/issues/32287
2025-04-25 05:43:01 +00:00
Ankush Menat
266ec9f76e
perf: Fix child table queries for int-PK parent (#32293)
Lessen but not eliminate impact of https://github.com/frappe/frappe/issues/32287
2025-04-25 05:33:07 +00:00
Ankush Menat
d998d520fb
perf: use raw query for reading int-pk docs too (#32286)
Currently only string PK is supported but that wasn't the intention,
isinstance check is only there to avoid dicts/filters.
2025-04-24 13:11:07 +00:00
Ankush Menat
5d380e6f93
Merge pull request #32040 from sokumon/eps-removal
refactor: separate EPS into an app
2025-04-23 17:40:16 +05:30
Ankush Menat
82c90bdbbd fix: Orphan doctype check should remove doctypes with no module 2025-04-23 12:02:58 +05:30
Ankush Menat
70e56b2e14
perf: Selectively switch to LIFO ordering when queue is starved (#32226)
When queue is overloaded every job gets delayed by size of the queue,
this means even interactive jobs like prepared reports face significant
wait times.

This flag allows developer to selectively enable LIFO on such jobs where
ordering doesn't matter. Any time we observe queue to be too large,
we'll insert the job at front so it gets highest priority.

This is a common strategy to deal with queue starvation, we are only
applying it explicitly because job execution order matters for
correctness in some cases.
2025-04-23 11:54:21 +05:30
Soham Kulkarni
f841f77534
Merge branch 'develop' into eps-removal 2025-04-23 01:21:07 +05:30
Akhil Narang
7255c5fdf2
fix(db_query): improve subquery check
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-22 11:40:09 +05:30
Akhil Narang
9cf718b8f6
fix(db_query): use re.DOTALL
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-22 11:30:29 +05:30
Mikie Sterner
0596e1c6c1 feat: Add Julian Day to Auto Naming series 2025-04-18 13:20:14 -06:00
sokumon
3827d86f87 fix: more cleanup 2025-04-17 00:26:57 +05:30
Akhil Narang
9e6a73f7c2
Merge pull request #31156 from akhilnarang/sqlite
feat: sqlite support
2025-04-16 08:56:52 +05:30
Ankush Menat
56e2a9ad2d
Revert "fix(HTML Editor): extraction of images" (#32129) 2025-04-15 22:21:40 +05:30
Akhil Narang
9fa330c075
fix(sqlite): use correct check for unique/primary key constraint violations
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:17 +05:30
Akhil Narang
ad32216040
fix: support sqlite
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:16 +05:30
Sagar Vora
39636fb260
Merge pull request #32101 from sagarvora/revert-meta-sig
revert: meta signature
2025-04-12 18:38:43 +05:30
Sagar Vora
beeeed4160 revert: meta signature 2025-04-12 18:29:25 +05:30
Ankush Menat
eb79ecaca9
chore: Revert document read only mode (#32102)
We can trust mappers to do the right thing, restricting few methods
doesn't prevent anything real anyway, unnecessary overhead and breakages.
2025-04-12 18:27:16 +05:30
Sagar Vora
7421ffa79a feat: use cached_property without locks on all supported Python versions 2025-04-11 13:21:27 +05:30
Sagar Vora
bd844579d2 refactor: trim frappe.__init__ 2025-04-06 10:30:23 +05:30
Sagar Vora
2a2700970d perf: pre-create UnionType objects 2025-03-20 21:34:07 +05:30
Raffael Meyer
9430e3af86
fix: respect override_whitelisted_method in map_docs (#31718)
* refactor: override_whitelisted_method

* fix: respect `override_whitelisted_method` in `map_docs`

* refactor: override_whitelisted_method
2025-03-17 14:27:12 +01:00
gavin
554c76aa13
Merge pull request #31706 from gavindsouza/fix-add_viewed
refactor: doc.add_viewed
2025-03-17 09:07:47 +01:00
Sagar Vora
36b2d47c14
Merge pull request #31750 from sagarvora/perf-as_dict-
perf: reduce repeated attribute access in `as_dict`
2025-03-17 09:26:01 +05:30
Sagar Vora
2414647964 perf: reduce repeated attribute access in as_dict 2025-03-17 09:15:55 +05:30
Sagar Vora
c7a037c3e4 perf: doc.permitted_fieldnames is now a set 2025-03-17 09:02:25 +05:30
Sagar Vora
6ca6e2aebd perf: improve get_permitted_fields logic 2025-03-17 08:55:32 +05:30
Sagar Vora
628ddfd494 perf: remove repeated calls to get_permitted_fieldnames 2025-03-16 23:39:46 +05:30
Sagar Vora
d50fdbe3bc perf: much faster doc.update 2025-03-16 13:58:45 +05:30
Sagar Vora
1da2706578 fix: allow user-defined __new__ 2025-03-16 11:13:01 +05:30
Ankush Menat
3bfc9fa8da
perf: Don't update list view settings on every query (#31743)
It literally doesn't do anything ever.

User settings are explicitly updated using `user_settings.save` endpoint.
2025-03-16 05:35:39 +00:00
Sagar Vora
32ff002c32 fix: revert valid columns cache
it is used only once when initialising doc
2025-03-16 01:10:29 +05:30
Sagar Vora
63f2c35290 perf: preset _table_fieldnames for child docs 2025-03-16 00:59:10 +05:30
Sagar Vora
09d0abcb54 fix: simplify load_from_db logic 2025-03-15 16:14:55 +05:30
Sabu Siyad
e012213ca2
docs: base_document: remove(): comment to docstring (#31720) 2025-03-14 16:30:12 +01:00
Gavin D'souza
dc807832fe
refactor: doc.add_viewed
* Don't check for unique_views if not needed - one less query/table scan
* Remove unnecessary indents
* Fix docstring
2025-03-13 11:11:47 +01:00
Ankush Menat
357b6fb11a
perf: don't parse comments just to get comment count (#28921)
This parsing isn't necessary and we are copying all of _comments just to count
how many there are.

Imagine 2500 documents w/ 1-2 auto generated comments each.
2025-03-13 05:00:21 +00:00
Akhil Narang
bada8cabcb
fix(db_query): improve regex
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-03-07 16:57:27 +05:30
Akhil Narang
3c01bf3d5c
fix: check properly for blacklisted function usage
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-03-05 14:17:39 +05:30