Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NQM] "where"-like methods with several conditions #11

Open
MikitaBf opened this issue Jul 18, 2023 · 0 comments
Open

[NQM] "where"-like methods with several conditions #11

MikitaBf opened this issue Jul 18, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@MikitaBf
Copy link

MikitaBf commented Jul 18, 2023

Describe SQL method
.where_all() method accepts several conditions as kwargs and checks whether all of the conditions are True. Example: cur.select(...).where_all(condition_1=value_1, condition_2=value_2, ...)

(from the previous example onwards cur is an object of fyCursor)

.where_any() method accepts several conditions as kwargs and checks whether at least one of these conditions is True. Example:
cur.select(...).where_any(condition_1=value_1, condition_2=value_2, ...)

(Optional) Describe how you'd like to implement this method
All conditions passed to where_all() are connected with AND keyword, while where_any() connects them with OR.

Examples:

cur.select("name", "table").where_all(balance=100, level=2)

executes following SQL query:
"SELECT name FROM table WHERE balance = 100 AND level = 100"

The same syntax but with .where_any method executes a similar SQL query but with OR keyword.

(Optional) Additional context
As those methods accept kwargs, the following syntax is also allowed:

.where_all({"cond_1": val_1, ...})
.where_any(
{"cond_1": val_1, ...})

@MikitaBf MikitaBf changed the title [NQM] where_all and where_any methods [NQM] "where"-like methods with several conditions Jul 18, 2023
@felixyeahh felixyeahh added the enhancement New feature or request label Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants