Commit graph

627 commits

Author SHA1 Message Date
Aradhya
8b73108270 feat: added PseudoColumnMapper for postgres support 2022-11-03 20:43:24 +05:30
Aradhya
e1719fd30c feat: Added support for table_field.fieldname and tests 2022-11-03 03:56:59 +05:30
Aradhya
88d506864b refactor: consistent quries and better naming 2022-11-02 17:21:37 +05:30
Aradhya
0bc2ba0545 refactor: better naming 2022-11-02 02:40:23 +05:30
Aradhya
e5d19d78d7 feat: considering parenttype while joining 2022-11-02 02:39:53 +05:30
Aradhya
8e118773f3 refactor: joining tables 2022-11-01 14:35:37 +05:30
Aradhya
5703303abb Merge branch 'develop' of https://github.com/frappe/frappe into qb-fixes 2022-11-01 13:45:11 +05:30
Ankush Menat
fec24632a9 style: format
[skip ci]
2022-11-01 13:36:37 +05:30
Aradhya Tripathi
5ed696cd3d
fix(qb): fixed implicit join for child tables (#18692)
* test: Added test for multiple joins
2022-11-01 11:25:02 +05:30
Ankush Menat
8cca50bf26
refactor: remove naming case feature (#18672)
This has never worked since 2016... which can mean two things:
- No one really uses this.
- If I fix this now suddenly people will find different behaviour in
  naming because `name_case` is selected in some doctypes (but never
  tested)
2022-10-31 11:23:49 +05:30
Aradhya Tripathi
862d7428a6
Merge branch 'develop' into qb-fixes 2022-10-27 20:29:32 +05:30
Aradhya
e6a281f19e refactor: better naming 2022-10-27 13:11:15 +05:30
Aradhya
15db8228f4 fix: adding additional conditions 2022-10-26 15:58:24 +05:30
Aradhya
e16ca03572 fix: fixed multiple descendants 2022-10-25 20:34:47 +05:30
Aradhya
69112cec39 refactor: removed static methods 2022-10-25 18:05:48 +05:30
Ritwik Puri
dad080842a
fix: don't print multiple print statements when database settings dont match with expected settings (#18492)
Also, fetch mariadb variables only once when checking mariadb variables
2022-10-22 21:55:12 +05:30
Aradhya
a65db344ee fix: empty nested result clause 2022-10-21 19:44:15 +05:30
Aradhya
35ce3c0ecc fix: fixed nested query results 2022-10-21 16:10:22 +05:30
Aradhya
48f2080769 refactor: better function naming 2022-10-20 22:35:08 +05:30
Aradhya
4a573e252c Merge branch 'develop' of https://github.com/frappe/frappe into qb-fixes 2022-10-20 22:25:44 +05:30
Aradhya Tripathi
457de5c6b3
fix: stripping comments sent to the database API (#18229)
* feat: stripping comments sent to the database API

* test: Added tests for comment stripping

* fix: only stripping comments in string fields

* refactor: removing on the fly mutations

* refactor: added helper to avoid mutations

* refactor: simplify sanitization

* refactor: removing indexing from everywhere

* refactor: readable functions

* test: only run mdb test on mdb

Co-authored-by: Ankush Menat <ankush@frappe.io>
2022-10-12 16:36:55 +05:30
Ankush Menat
64a0e19329 Revert "fix!: Dont update modified by default in db.set_value (#18301)"
This reverts commit 6aaefd6633.
2022-10-06 22:02:31 +05:30
Ankush Menat
bfa6a5fbdf fix: better cache validation
- Only delete a single doc if we know which doc changed
- Drop all docs other wise (kinda bad, but this isn't used frequently,
  will fix when visiting entire caching system again)
2022-10-06 19:46:58 +05:30
Ankush Menat
cee2b50461 perf: single query db.set_value 2022-10-06 19:46:58 +05:30
Ankush Menat
6aaefd6633
fix!: Dont update modified by default in db.set_value (#18301) 2022-10-06 16:01:20 +05:30
Ankush Menat
da561c237d fix: index column should be first 2022-10-06 11:11:03 +05:30
Ankush Menat
cbe4b59100 fix: correct index re-syncing
The implementation of syncing unique and non-unique index depended on
index names which used to be different before because of that there's
tendency to incorrectly identify index.

This PR adds a separate util for checking if a column has index without
relying on naming convention. It just goes and checks if there's any
index with that column in it, hence far more reliable.
2022-10-06 11:11:03 +05:30
Ankush Menat
6de41a78e9 refactor: guard clause 2022-10-06 11:11:03 +05:30
Aradhya Tripathi
c15da987eb
Merge branch 'develop' into qb-fixes 2022-09-21 02:24:23 +05:30
Aradhya
ee3651b103 refactor: separated nested set logic 2022-09-20 01:54:41 +05:30
Aradhya
38f1a9708a refactor: simplified logic 2022-09-20 01:45:20 +05:30
Ankush Menat
82cd238f54
perf!: Only add modified index on parent doctypes (#18119)
When are child tables sorted by timestamp by default?
2022-09-15 19:16:12 +05:30
Ankush Menat
5152f13b10 fix: RQ reduce failed job TTL from 1 year to 7 days 2022-09-10 23:54:43 +05:30
Ankush Menat
ea7fbb2c10 refactor: remove dead flag db.read_only
This was added in last DB refactor but it does nothing, it was probably
supposed to do something with the connection pool but to best of my
knowledge "read only" is not a property of a connection.

It can be achieved with users who only have read access, that however
isn't implemented anywhere.

Removing this for now.
2022-09-09 17:34:46 +05:30
Ankush Menat
f96505fae0 feat: wrap read only mode SQL errors 2022-09-09 17:34:44 +05:30
Ankush Menat
4389447148 fix: always explicitly start a new transaction
Active read only transaction can be aborted by doing a commit and then
issuing queries. This prevents such edge cases.
2022-09-08 18:22:08 +05:30
Ankush Menat
5e86e1f192 feat: db.begin(read_only=True)
You can now start read only transaction by passing read only flag. Read
only transactions prevent any query that is of "WRITE" type like
insert/delete/update.
2022-09-08 18:22:03 +05:30
Aradhya
520c8503a8 refactor: using cached property 2022-09-05 16:04:38 +05:30
Aradhya
ae18f74311 feat: Added nested set support 2022-09-03 19:15:35 +05:30
Aradhya
3cb98121a8 refactor: more PseudoColumn checks :( 2022-09-02 00:16:08 +05:30
Aradhya
6262119eec refactor: removed dead code 2022-09-01 20:04:04 +05:30
Aradhya
0c09dd4863 fix: not joining twice implicitly 2022-09-01 20:03:43 +05:30
Aradhya
e576d16855 refactor: using refactored TABLE_PATTERN for finding fields 2022-08-31 15:44:43 +05:30
Aradhya
c55afe23f8 refactor: removed flaky implicit joins 2022-08-30 16:40:47 +05:30
Aradhya
ec100d7a8a fix: misc fixes 2022-08-30 16:36:00 +05:30
Aradhya
edfa63a4cf fix: lint 2022-08-28 00:08:13 +05:30
Aradhya
f36eda1e83 refactor: using enumerate while indexing on the fly 2022-08-24 14:44:18 +05:30
Aradhya
8fe5a64140 fix: fixed complex toupper implementation 2022-08-24 14:39:43 +05:30
Aradhya
712416ceb0 refactor: changed function name to better define usage 2022-08-22 14:52:41 +05:30
Aradhya
535b64931e refactor: using enumerate to iterate over fields & warn when passing query object to def sql 2022-08-22 14:49:30 +05:30