Commit graph

276 commits

Author SHA1 Message Date
Aradhya
4a573e252c Merge branch 'develop' of https://github.com/frappe/frappe into qb-fixes 2022-10-20 22:25:44 +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
Aradhya Tripathi
c15da987eb
Merge branch 'develop' into qb-fixes 2022-09-21 02:24:23 +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
6262119eec refactor: removed dead code 2022-09-01 20:04:04 +05:30
Aradhya
edfa63a4cf fix: lint 2022-08-28 00:08:13 +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
Aradhya Tripathi
e73ae6f039
Merge branch 'develop' into get-all-mod 2022-08-19 15:42:35 +05:30
Ankush Menat
f002016eb6
chore: limit over-logging of handled exception (#17878)
[skip ci]
2022-08-19 12:53:51 +05:30
Aradhya
9bb39131c0 refactor: changed get_value_for_many_names to get tuple values 2022-08-14 14:34:02 +05:30
Aradhya
ba2caf206b feat: Added parameterization on queries going through database.py 2022-08-14 12:52:00 +05:30
Gavin D'souza
73994e3b46 refactor(minor): PY310+ API Usages 2022-08-10 19:34:52 +05:30
Gavin D'souza
22f79d735b fix: raise ImplicitCommitError instead of bare exception 2022-08-10 18:45:17 +05:30
Ritwik Puri
cb6438158b
fix: don't use cache for sequence in mariadb (#17640)
* fix: don't use cache for sequence in mariadb

* chore: update sequence related comments
2022-07-27 22:46:56 +05:30
Gavin D'souza
1dbc0b4d3c fix(db*): Use common fallback Datetime str
There existed inconsistencies between db_query & db's fallback for min
datetime in str format - missing decimal seconds places. Now, we're
storing the default string once and re-using it to reduce
inconsistencies or room for human errors.
2022-07-22 13:19:25 +05:30
Gavin D'souza
1a610e135d fix(db): Use sentinel object for default values paramters 2022-07-22 12:11:01 +05:30
Gavin D'souza
e411132c6e fix(db): Revert breaking change of wrapping NoneType in sequence 2022-07-22 12:11:01 +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
Ankush Menat
0164a87ac9
Merge pull request #17350 from Aradhya-Tripathi/get-all-mod
feat: Adding support to Query engine
2022-07-13 18:36:04 +05:30
Sagar Vora
4671460b65
fix: dont scrub key if found in defaults, but falsy (#17467)
* fix: dont scrub key if found in defaults, but falsy

* fix: remove redundant use of `.get`
2022-07-12 17:06:06 +05:30
Sagar Vora
fc99c22ea2
fix: ensure that frappe.db.get_defaults works for all parents (#17296)
fix: ensure that frappe.db.get_defaults` for all parents, as designed
2022-07-08 18:08:36 +05:30
Gavin D'souza
8ccc0d039b fix: Database._transform_query
* Don't try to convert None to sequence
* Skip transforming values that mariadb~=1.1 can handle - only worry
  about sequences for now
2022-07-07 15:59:48 +05:30
Gavin D'souza
41b93392b1 fix: Database._transform_result
Transform data not already casted by mariadb client
2022-07-06 15:58:45 +05:30
Gavin D'souza
6a76f8ad5f fix(pg): Transform Falsy values as None
ref: https://github.com/frappe/frappe/runs/7208763442
2022-07-06 11:47:43 +05:30
Gavin D'souza
1faa2fd1e2 fix: Format string instead of % to avoid TypeError 2022-07-06 10:52:48 +05:30
Gavin D'souza
dbb37acedf fix: Transform queries with all types of values 2022-07-05 17:47:14 +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
Ankush Menat
c12b52a259 refactor: use frappe.get_system_settings
Not sure why this needs YET ANOTHER separate cache.
2022-07-04 11:25:47 +05:30
Aradhya Tripathi
ebd1d5b48c
Merge branch 'develop' into get-all-mod 2022-07-01 13:25:32 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Gavin D'souza
fddd624a7c Merge branch 'develop' of github.com:frappe/frappe into mariadb-client-refactor 2022-06-30 14:31:52 +05:30
Ankush Menat
813dcc1848
Revert "feat: Adding support to Query engine" 2022-06-29 23:30:23 +05:30
Aradhya
4da5fdcd02 fix: fixed spaces in args
fix: lint
2022-06-29 17:37:49 +05:30
Gavin D'souza
cf699fe40b Merge branch 'develop' of github.com:frappe/frappe into mariadb-client-refactor 2022-06-29 13:49:18 +05:30
Ankush Menat
181833848f
Merge pull request #17337 from ankush/lint_cleanup
fix: remove bare exception catching
2022-06-29 11:39:05 +05:30
gavin
91e76ff874
Merge branch 'develop' into get-all-mod 2022-06-28 19:47:20 +05:30
Aradhya
6db6be1f3c refactor: frappe.qb.engine
* Small fixes in set_fields and clean code
* Optimize casefolds
* Fixed functions passed in List
* get_sql => get_query - more expressive, less confusion
* Updated tests
2022-06-28 19:43:57 +05:30
Aradhya
7732accded feat: Attached Engine object to qb & added dynamic type hints 2022-06-28 19:43:23 +05:30
Aradhya
fca026927e refactor: moved all query logic to query class 2022-06-28 19:41:32 +05:30
Ankush Menat
d35d7ffbe2 fix: remove bare exception catching
A bare except catches lots of things (like generator iteration end) and should never be used.
2022-06-28 18:05:00 +05:30
Gavin D'souza
b8d2c195a6 fix: Disable connection pooling via bench commands unless specified 2022-06-23 19:42:12 +05:30
Gavin D'souza
ef078a4ab5 refactor(db-read_only): Track conn type in Database instance 2022-06-23 19:40:17 +05:30
Gavin D'souza
a58a5bb848 fix: Improve _transform_query unique key identification 2022-06-20 13:10:13 +05:30