garf-core 0.0.7__py3-none-any.whl → 0.0.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
garf_core/__init__.py CHANGED
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = '0.0.7'
15
+ __version__ = '0.0.8'
@@ -38,12 +38,17 @@ class ApiReportFetcher:
38
38
 
39
39
  Attributes:
40
40
  api_client: a client used for connecting to API.
41
+ parser: Type of parser to convert API response.
42
+ query_specification_builder: Class to perform query parsing.
41
43
  """
42
44
 
43
45
  def __init__(
44
46
  self,
45
47
  api_client: api_clients.BaseApiClient,
46
48
  parser: parsers.BaseParser = parsers.ListParser,
49
+ query_specification_builder: query_editor.QuerySpecification = (
50
+ query_editor.QuerySpecification
51
+ ),
47
52
  **kwargs: str,
48
53
  ) -> None:
49
54
  """Instantiates ApiReportFetcher based on provided api client.
@@ -51,9 +56,11 @@ class ApiReportFetcher:
51
56
  Args:
52
57
  api_client: Instantiated api client.
53
58
  parser: Type of parser to convert API response.
59
+ query_specification_builder: Class to perform query parsing.
54
60
  """
55
61
  self.api_client = api_client
56
62
  self.parser = parser()
63
+ self.query_specification_builder = query_specification_builder
57
64
  self.query_args = kwargs
58
65
 
59
66
  async def afetch(
@@ -65,12 +72,12 @@ class ApiReportFetcher:
65
72
  """Asynchronously fetches data from API based on query_specification.
66
73
 
67
74
  Args:
68
- query_specification: Query text that will be passed to API
69
- alongside column_names, customizers and virtual columns.
70
- args: Arguments that need to be passed to the query.
75
+ query_specification: Query text that will be passed to API
76
+ alongside column_names, customizers and virtual columns.
77
+ args: Arguments that need to be passed to the query.
71
78
 
72
79
  Returns:
73
- GarfReport with results of query execution.
80
+ GarfReport with results of query execution.
74
81
  """
75
82
  return self.fetch(query_specification, args, **kwargs)
76
83
 
@@ -83,19 +90,19 @@ class ApiReportFetcher:
83
90
  """Fetches data from API based on query_specification.
84
91
 
85
92
  Args:
86
- query_specification: Query text that will be passed to API
87
- alongside column_names, customizers and virtual columns.
88
- args: Arguments that need to be passed to the query.
93
+ query_specification: Query text that will be passed to API
94
+ alongside column_names, customizers and virtual columns.
95
+ args: Arguments that need to be passed to the query.
89
96
 
90
97
  Returns:
91
- GarfReport with results of query execution.
98
+ GarfReport with results of query execution.
92
99
 
93
100
  Raises:
94
- GarfExecutorException:
95
- When customer_ids are not provided or API returned error.
101
+ GarfExecutorException:
102
+ When customer_ids are not provided or API returned error.
96
103
  """
97
104
  if not isinstance(query_specification, query_editor.QuerySpecification):
98
- query_specification = query_editor.QuerySpecification(
105
+ query_specification = self.query_specification_builder(
99
106
  text=str(query_specification),
100
107
  args=args,
101
108
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: garf-core
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Summary: Abstracts fetching data from API based on provided SQL-like query.
5
5
  Author-email: "Google Inc. (gTech gPS CSE team)" <no-reply@google.com>
6
6
  License: Apache 2.0
@@ -1,13 +1,13 @@
1
- garf_core/__init__.py,sha256=YXfq75YjkKDgNZM8YGRyE5aGGLa3MUVQasljixjp-70,598
1
+ garf_core/__init__.py,sha256=-2NI7Qm5ndrlcaz3itBBuFXOKu4anul2TdJro2G5oRo,598
2
2
  garf_core/api_clients.py,sha256=FKmwts_QBV_E4aTmrnsZtow0CmSExLibfeSkMSrudU0,2235
3
3
  garf_core/base_query.py,sha256=uEhKP56wcFtMiSwYOxoZ0q7OEvURGVOeRdpSYjxWLho,1201
4
4
  garf_core/exceptions.py,sha256=4qvNN-8GqbbVsrLKxJwBeX1FUtWpKbhUWyvm7anD3iE,1916
5
5
  garf_core/parsers.py,sha256=Y4wwpDXRZky7LBTBklvzk-aDNxgRL5RJg52rSdH5t9Q,2928
6
6
  garf_core/query_editor.py,sha256=EzwjFnbje-RcP9VwWQwzCpy8lipt4tph3Kv6q5Lly5o,15994
7
7
  garf_core/report.py,sha256=xlkZ44cdT_uGENuNeGwy69h7XLtwjdUjyPw3S1m-zc8,17852
8
- garf_core/report_fetcher.py,sha256=g2bmqq8m3XxrWh1tDJ7ZO6iCys34mX8Dm55ZaT_36TI,3813
9
- garf_core-0.0.7.dist-info/METADATA,sha256=gn0SYdh11jDgZKJJW4m1bD6TfYM90mbq-lqOWm7kQR4,2334
10
- garf_core-0.0.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
11
- garf_core-0.0.7.dist-info/entry_points.txt,sha256=ODxSZXwWEIXQAjRwBQsBJ6GYw8oPK6DYTo0oDVkKCpo,39
12
- garf_core-0.0.7.dist-info/top_level.txt,sha256=Gj-Zp7fM2turGut5vTJuo5xEcKfow7cTLX3y3WFfNgA,10
13
- garf_core-0.0.7.dist-info/RECORD,,
8
+ garf_core/report_fetcher.py,sha256=j1ewWoUvnEGM5vmWihFJ7vSVVEG1t2yzapKhylc-7eQ,4157
9
+ garf_core-0.0.8.dist-info/METADATA,sha256=Ap-TAWp1wzDtXO6WPUBE1ajGnzQ_YMUIRiIhZbzLcm8,2334
10
+ garf_core-0.0.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
11
+ garf_core-0.0.8.dist-info/entry_points.txt,sha256=ODxSZXwWEIXQAjRwBQsBJ6GYw8oPK6DYTo0oDVkKCpo,39
12
+ garf_core-0.0.8.dist-info/top_level.txt,sha256=Gj-Zp7fM2turGut5vTJuo5xEcKfow7cTLX3y3WFfNgA,10
13
+ garf_core-0.0.8.dist-info/RECORD,,