Commit graph

14 commits

Author SHA1 Message Date
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Abhishek Saxena
5c8856d66e
refactor: db.sql calls to frappe.qb (#16107)
# Changes

- Introduces `subqry` class to use in where clause when there is a non-column condition. eg.
> .where(subqry(no_of_roles) == 0)
- Convert SQL queries to frappe.qb 

# Testing

Functions with query refactors
- frappe.boot.get_user_pages_or_reports() -> Same output of `get_bootinfo()` as develop
- frappe.boot.get_unseen_notes() -> Forms the same query as develop 
```sql
SELECT `name`,`title`,`content`,`notify_on_every_login`
FROM `tabNote` WHERE `notify_on_every_login`=1
AND `expire_notification_on`>'2022-03-30 01:10:53.393874'
AND (SELECT `nsb`.`user` FROM `tabNote Seen By` `nsb` WHERE `nsb`.`parent`=`tabNote`.`name`) NOT IN ('Administrator')
```
- frappe.installer._delete_doctypes() -> installed and uninsalled a dummy app to drop tables

### Not tested
- frappe.make_property_setter()
- frappe.realtime.get_pending_tasks_for_doc() [whitelist method]
- frappe.sessions.Session.start()
- frappe.twofactor.cache_2fa_data()
2022-04-12 05:07:25 +00:00
Gavin D'souza
2d806b5d6d fix: Ported subqry to branch for compatibility
Via https://github.com/frappe/frappe/pull/16107
2022-03-31 13:41:08 +05:30
saxenabhishek
44d7940746 fix: missing param_wrapper in recursive calls 2022-02-03 12:32:47 +05:30
Gavin D'souza
229e259bd2 fix: Format timedelta object accurately 2022-01-31 11:56:09 +05:30
saxenabhishek
97d6a96419 fix: timedelta parsing in pypika 2022-01-25 13:28:11 +05:30
saxenabhishek
02bdc35490 fix: make parameters for strings only 2022-01-15 14:55:28 +05:30
saxenabhishek
471c0bd697 docs: Working of NamedParameters in qb 2022-01-11 01:01:44 +05:30
saxenabhishek
e2d49c17ff refactor: remove reduandant func call 2022-01-11 01:01:44 +05:30
saxenabhishek
0f75394720 refactor: pythonic NamedParameterWrapper 2022-01-11 01:01:44 +05:30
Gavin D'souza
04e79eb075 fix(qb:ValueWrapper): Use get_value_sql only for str values 2022-01-10 13:25:47 +05:30
saxenabhishek
6120b4b3c1 fix: extend named parameters to frappe.qb.function 2021-12-06 14:32:55 +05:30
saxenabhishek
9fdacedfc8 feat: sanitise frappe.qb 2021-12-06 14:29:57 +05:30
saxenabhishek
a574c1ba88 chore: patching ValueWrapper 2021-12-06 14:27:42 +05:30