kayak / pypika

PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.
http://pypika.readthedocs.io/en/latest/
Apache License 2.0
2.5k stars 295 forks source link

Initial support for JQL #721

Open doc-sheet opened 1 year ago

doc-sheet commented 1 year ago

Hello.

There is some basic support for JQL, could you suggest some impovements?

For now it produces

project IN ("PROJ1","PROJ2") AND issuetype="My issue" AND (labels is EMPTY OR labels NOT IN ("stale","bug")) AND Привет is EMPTY AND repos is not EMPTY AND repos NOT IN ("main","dev")

for a query like this

J = JiraTable()
j = (
    JiraQueryBuilder()
    .where(J.project.isin(["PROJ1", "PROJ2"]))
    .where(J.issuetype == "My issue")
    .where(J.labels.isempty() | J.labels.notin(["stale", "bug"]))
    .where(getattr(J, "Привет").isempty())
    .where(J.repos.notempty() & J.repos.notin(["main", "dev"]))
)
print(j.get_sql())
AzisK commented 1 year ago

By JQL do you mean the selection in Jira or does it have more meanings?

AzisK commented 1 year ago

Could you add tests?

doc-sheet commented 1 year ago

By JQL do you mean the selection in Jira or does it have more meanings? Yeah, jql as jira query language

I din't aim for full support, just the tools I use myself. But I can add more if needed. I guess.

AzisK commented 1 year ago

I believe there is no need to start with full support. We can start little and then later extend it. Could you also add this possibility in the documentation?

doc-sheet commented 1 year ago

Sure! Done.

doc-sheet commented 1 year ago

ugh There was a dependency conflict in my venv: https://stackoverflow.com/a/71674345