Commit graph

547 commits

Author SHA1 Message Date
Himanshu
3faaf5f361
Merge branch 'develop' into merge_translated_doctypes 2022-08-12 13:10:49 +01:00
Gavin D'souza
91a47c2602 fix: Deprecate setup help database APIs
APIs have been unused since ~v4/6? Don't see any need to keep them in.
2022-08-12 12:52:19 +05:30
Himanshu
e68aac866f
Merge branch 'develop' into merge_translated_doctypes 2022-08-10 18:49:04 +01:00
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
Gavin D'souza
b13298d69c fix(db): Log mogrified queries
Prior to this, queries passed to `frappe.db.sql` with values looked like:

"SELECT `defkey`,`defvalue` FROM `tabDefaultValue` WHERE `parent`=%(param1)s ORDER BY `creation`"

Now, they'll look "normal" or built like:

"SELECT `defkey`,`defvalue` FROM `tabDefaultValue` WHERE `parent`='__global' ORDER BY `creation`"
2022-08-10 18:31:44 +05:30
hrwx
b01929405d refactor: translatable doctypes 2022-08-05 21:38:10 +01:00
Shariq Ansari
a772cc0796
fix: removing unused import line (#17654) 2022-07-29 10:24:49 +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
2bef29bb46 chore: Deprecate backup script + minor refactors 2022-07-22 13:21:29 +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
bcfa8c276e fix: Set default port attribute for Database classes
db.default_port wil be available as a class attribute to hold defaults
for DB types.

Usage: frappe.conf.db_port or frappe.db.default_port
Why: I couldn't run the mariadb command because the defaults aren't set
for my system. server is remote / containerized. Setting port in
equivalent mysql command fixes this.
2022-07-22 13:16:26 +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
006ebcbede refactor: Use pymysql over mariadb client
This is supposed to be a temporary switch to make the parent PR easier
to digest. MariaDB client has some issues with release, and system
dependencies.

This commit may be reverted to enable mariadb client again.
2022-07-22 12:10:54 +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
Ankush Menat
3fdd89a737
refactor!: remove old weekly cleanup for route history (#17493)
This is now configurable with log settings.

This also fixes circular import issue that occurs when restoring backup
2022-07-13 11:02:56 +05:30
Aradhya
7658c60f57 feat: Added fall back for custom functions 2022-07-13 03:25:02 +05:30
Aradhya
64463791a1 feat: Added support for multiple functions in string fields & fixed aliasing 2022-07-12 22:07:11 +05:30
Aradhya
dbbd9e9095 fix: removing functions from strings when alias is same as function name 2022-07-12 17:59:37 +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
Aradhya
613065fa2e feat: Added support for aliasing in function objects 2022-07-09 22:27:29 +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
43f378d848
Merge branch 'develop' into mariadb-client-refactor 2022-07-07 16:00:38 +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
576fa32af4 fix(mariadb): SequenceGeneratorLimitExceeded is an OperationalError now
:D
2022-07-07 12:09:36 +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
4dc2ecefba fix: Use mariadb's constants instead of pymysql 2022-07-05 17:47:54 +05:30
Gavin D'souza
dbb37acedf fix: Transform queries with all types of values 2022-07-05 17:47:14 +05:30
Ankush Menat
5d2aedc698 fix(postgres): end transaction before DDL
closes https://github.com/frappe/frappe/issues/17210
2022-07-05 17:43:02 +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
261fbfcd11
Revert "fix(doc)!: Always cast datetime, date and time fields"
Revert "fix(doc)!: Always cast datetime, date and time fields (#15891)"

This reverts commit d7789ab6ff.
2022-07-05 13:43:32 +05:30
Himanshu
d7789ab6ff
fix(doc)!: Always cast datetime, date and time fields (#15891)
### BREAKING CHANGE
#### Datetime, Date and Time fields will always be cast to respective objects in `setattr`, this will ensure uniformity while accessing the values, no more `getdate`, `get_datetime`, `to_timedelta` wrapper.
- While importing data, the framework does check for `set_only_once`.
- In normal case scenarios, this will work flawlessly since most date fields might not be set_only_once.
- But in Subscription, the date field is set to `set_only_once` and in `after_insert`, `document.save` is called, and while doing so, `set_only_once` is checked [here](1944a547f9/frappe/model/document.py (L566)).
-This works fine if the data imported is in the correct format.
- If the date's data is not in the correct format, the framework throws an error.
- for eg `06-02-2022 00:00:00 != 06-02-2022`
- fixes [Issue/#15370](https://github.com/frappe/frappe/issues/15370)

> no-docs
2022-07-05 07:07:16 +00:00
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
39d30ffeaa fix: Database._transform_query
* Handle dict substitutions in transformations too
* Allow list / tuple values
* Check for values inconsistencies before flattening step
2022-06-30 19:12:10 +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
701bf2ede6 fix: fixed false operator placements in query 2022-06-29 22:34:43 +05:30
Aradhya
25bb945de7 feat: Added truediv & mul operators 2022-06-29 17:37:52 +05:30
Aradhya
4da5fdcd02 fix: fixed spaces in args
fix: lint
2022-06-29 17:37:49 +05:30
Gavin D'souza
daf3f05fea fix(db): Hanlde sequences in db.sql values 2022-06-29 16:32:00 +05:30
Aradhya
58645998c0 fix: fixed fields with operators and added abs 2022-06-29 15:03:37 +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