Title: | SQL Like Query Interface for 'Jira' |
---|---|
Description: | SQL like query interface to fetch data from any 'Jira' installation. The data is fetched using 'Jira' REST API, which can be found at the following URL: <https://developer.atlassian.com/cloud/jira/platform/rest/v2>. |
Authors: | Nikhil Choudhry [aut, cre] |
Maintainer: | Nikhil Choudhry <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2024-11-11 03:28:27 UTC |
Source: | https://github.com/nikhilchoudhry/njira |
Authenticates the user to fetch data from the respective Jira installation.
jira.login(jira.env = NULL, jira.user = NULL, jira.pwd = NULL, jira.val = 0, logs = FALSE)
jira.login(jira.env = NULL, jira.user = NULL, jira.pwd = NULL, jira.val = 0, logs = FALSE)
jira.env |
Web address of 'Jira' environment (e.g. https://issues.apache.org/jira) |
jira.user |
Jira User Name |
jira.pwd |
Jira Password |
jira.val |
0/1 how should the list values be returned in the query results |
logs |
debug logs required on not (Default = FALSE) |
The function authenticates the user into Jira installation and caches the Jira credentials.
jira.login(jira.env="https://issues.apache.org/jira", jira.user="jiraTestUser", jira.pwd="jiraTestPwd")
jira.login(jira.env="https://issues.apache.org/jira", jira.user="jiraTestUser", jira.pwd="jiraTestPwd")
Returns the 'metadata' of Jira which includes 'table' and 'field' names, valid for respective Jira installation. These table and field names can be referred while creating a Jira Query.
jira.metadata(table = NULL, fields = NULL)
jira.metadata(table = NULL, fields = NULL)
table |
Name of the Jira tables. If not specified, all the tables of the given interface are returned. |
fields |
List of field names whose details are required. If not specified, all the fields of the specified tables are returned. |
Data frame of Jira tables and field names.
fields <- jira.metadata() fields <- jira.metadata(table = "history") fields <- jira.metadata(table = "issues") fields <- jira.metadata(table = "issues", fields = c("Created", "Date Required", "Dev Status"))
fields <- jira.metadata() fields <- jira.metadata(table = "history") fields <- jira.metadata(table = "issues") fields <- jira.metadata(table = "issues", fields = c("Created", "Date Required", "Dev Status"))
Query Jira using SQL like query syntax. The query response from Jira REST API is returned as a dataframe.
jira.query(table, fields = NULL, where = NULL, groupby = NULL)
jira.query(table, fields = NULL, where = NULL, groupby = NULL)
table |
Name of Jira table from which data will be fetched. |
fields |
Comma separated names of the fields from the specified table whose values will be fetched. |
where |
specifies the where clause of the query. You can also pass your Jira JQL as-is in the where clause. |
groupby |
specifies the list of fields on which the data is grouped. |
For querying Jira 'history' table, the where clause must specify issue 'id'
Example : where = "id = 'HIVE-22692'"
Data frame of results returned by the Jira query.
issues <- jira.query(table = "issues", fields = "id AS IssueId, Created, Status, Priority", where = "project = 'HIVE' AND created >= '2019-01-01' AND created <= '2019-12-31' AND Status IN ('Open', 'Closed', 'Resolved')") issues <- jira.query(table = "issues", fields = "id AS IssueId, Created", where = "'cf[10021]' = 'ABCD' AND Created > '2019-01-01'") history <- jira.query(table = "history", where = "id = 'HIVE-22692'") history <- jira.query(table = "history", fields = "id AS IssueId, toString AS Status, COUNT(fromString) AS Count", where = "id = 'HIVE-22692' AND field = 'status'", groupby = "id,toString")
issues <- jira.query(table = "issues", fields = "id AS IssueId, Created, Status, Priority", where = "project = 'HIVE' AND created >= '2019-01-01' AND created <= '2019-12-31' AND Status IN ('Open', 'Closed', 'Resolved')") issues <- jira.query(table = "issues", fields = "id AS IssueId, Created", where = "'cf[10021]' = 'ABCD' AND Created > '2019-01-01'") history <- jira.query(table = "history", where = "id = 'HIVE-22692'") history <- jira.query(table = "history", fields = "id AS IssueId, toString AS Status, COUNT(fromString) AS Count", where = "id = 'HIVE-22692' AND field = 'status'", groupby = "id,toString")
The function parses the fields clause and returns the modified string as per the specified mode. The fields clause supported format is represented by the following BNF:
<field.list> := <field.expr> ( DELIMIT.COMMA <field.expr> ) * <field.expr> := ( FIELD.NAME | <aggr.func> LEFT.PAREN FIELD.NAME RIGHT.PAREN ) [ AS.ALIAS FIELD.NAME ] <aggr.func> := FUNC.MIN | FUNC.MEDIAN | FUNC.AVG | FUNC.MAX | FUNC.COUNT | FUNC.SUM
rk.fields(fields, mode = "@")
rk.fields(fields, mode = "@")
fields |
clause following simplified sql syntax. |
mode |
specifies the parsing logic. The default value '@' returns the field list in perfmeter query format. The '+' value returns a field list used for grouping the dataframe with alias names. The '=' value returns a field list used for grouping the dataframe with original names. The '*' value returns the alias list used for renaming the columns. Any other value returns a field list used for selecting columns from a dataframe. |
The function returns the processed fields clause.
The function parses the groupby clause and returns the modified string as per the specified mode.
rk.groupby(groupby = NULL, mode = "@")
rk.groupby(groupby = NULL, mode = "@")
groupby |
clause following simplified sql syntax. |
mode |
specifies the parsing logic. The default value '@' returns the groupby clause in perfmeter format. Any other value returns the groupby fields used for aggregation. |
The function returns the processed groupby clause.
The function returns the list of tables, fields, and their descriptions.
rk.metadata(table = NULL, fields = NULL, gettabs, getflds, infofile = NULL)
rk.metadata(table = NULL, fields = NULL, gettabs, getflds, infofile = NULL)
table |
name of the interface tables. If not specified, all the tables of the given interface are returned. |
fields |
is the list of field names whose details are required. If not specified, all the fields of the specified tables are returned. |
gettabs |
is a function that returns the list of all the tables for the given interface. |
getflds |
is a function that returns the list of all the fields for the given table. |
infofile |
is the name of the file containing information about different tables and fields of the given interface. |
The function returns the resulting data frame.
The function applies the given fields, where clause, and group by fields on the specified data frame.
rk.query(dframe, fields = NULL, where = NULL, groupby = NULL)
rk.query(dframe, fields = NULL, where = NULL, groupby = NULL)
dframe |
data frame to be processed. |
fields |
fields to be filtered. |
where |
clause applied on the data. |
groupby |
used to aggregate the fields. |
The function returns the resulting data frame.
The function parses the where clause and returns the modified string as per the specified mode. The where clause supported format is represented by the following BNF:
<where.cond> := <where.and> [ LOGICAL.OR <where.cond> ] <where.and> := <where.not> [ LOGICAL.AND <where.and> ] <where.not> := [ LOGICAL.NOT ] <where.clause> <where.clause> := LEFT.PAREN <where.cond> RIGHT.PAREN | <where.expr> <where.expr> := ( IDENTIFIER | QUOTE.STR ) ( [ LOGICAL.NOT ] ( OPERATOR.IN <value.list> | OPERATOR.LIKE <value.const> ) | OPERATOR.IS [ LOGICAL.NOT ] VALUE.NULL | <logic.cond> ) <logic.cond> := ( EQUAL.TO | NOT.EQUAL | LESS.THAN | GREATER.THAN | LESS.EQUAL | GREATER.EQUAL ) <value.const> <value.list> := LEFT.PAREN <value.const> ( DELIMIT.COMMA <value.const> ) * RIGHT.PAREN <value.const> := | QUOTE.STR | NUMBER
rk.where(where = NULL, mode = "@", fields = NULL)
rk.where(where = NULL, mode = "@", fields = NULL)
where |
clause following simplified sql syntax. |
mode |
specifies the parsing logic. The default value '@' returns the where clause in perfmeter format. The '=' value returns the where clause in IOD format. The '~' value returns the where clause in Jira format. The ” (empty string) value returns a where clause used with a sql statement. If a dataframe name is passed, the function returns the where clause for use with a dataframe. |
fields |
fields to be filtered. |
The function returns the processed where clause.