Skip to content

Commit 38812cd

Browse files
authored
Merge pull request #646 from GideonCS/patch-1
Fixed Grammar on the Query Format Page
2 parents 7a07dc3 + 0a69a8b commit 38812cd

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

docs/Cube.js-Frontend/Query-Format.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ category: Cube.js Frontend
55
menuOrder: 1
66
---
77

8-
Query is plain JavaScript object, describing an analytics query. The basic elements of query (query members) are `measures`, `dimensions`, and `segments`.
8+
Cube Queries are plain JavaScript objects, describing an analytics query. The basic elements of a query (query members) are `measures`, `dimensions`, and `segments`.
99

10-
The query member format name is `CUBE_NAME.MEMBER_NAME`, for example dimension email in the Cube Users would have the following name `Users.email`.
10+
The query member format name is `CUBE_NAME.MEMBER_NAME`, for example the dimension `email` in the Cube `Users` would have the name `Users.email`.
1111

12-
In a case of dimension of type time granularity could be optionally added to the name, in the following format `CUBE_NAME.TIME_DIMENSION_NAME.GRANULARITY`, ex: `Stories.time.month`.
12+
In the case of dimension of type `time` granularity could be optionally added to the name, in the following format `CUBE_NAME.TIME_DIMENSION_NAME.GRANULARITY`, ex: `Stories.time.month`.
1313

1414
Supported granularities: `second`, `minute`, `hour`, `day`, `week`, `month`.
1515

1616
## Query Properties
1717

18-
Query has the following properties:
18+
A Query has the following properties:
1919

2020
- `measures`: An array of measures.
2121
- `dimensions`: An array of dimensions.
2222
- `filters`: An array of objects, describing filters. Learn about [filters format](#filters-format).
23-
- `timeDimensions`: A convient way to specify a time dimension with a filter. It is an array of objects in [timeDimension format.](#time-dimensions-format)
24-
- `segments`: An array of segments. Segment is a named filter, created in the Data Schema.
23+
- `timeDimensions`: A convenient way to specify a time dimension with a filter. It is an array of objects in [timeDimension format.](#time-dimensions-format)
24+
- `segments`: An array of segments. A segment is a named filter, created in the Data Schema.
2525
- `limit`: A row limit for your query. The default value is `10000`. The
2626
maximum allowed limit is `50000`.
27-
- `offset`: Number of first rows to be skipped for your query. The default value is `0`.
28-
- `order`: An object, where keys are measures or dimensions to order by and
27+
- `offset`: The number of initial rows to be skipped for your query. The default value is `0`.
28+
- `order`: An object, where the keys are measures or dimensions to order by and
2929
their corresponding values are either `asc` or `desc`. The order of the
30-
fields to order is based on the order of the keys in the object.
30+
fields to order on is based on the order of the keys in the object.
3131
- `timezone`: All time based calculations performed within Cube.js are timezone-aware. Using this property you can set your desired timezone in [TZ Database Name](https://en.wikipedia.org/wiki/Tz_database) format, e.g.: `America/Los_Angeles`. The default value is `UTC`.
32-
- `renewQuery`: If `renewQuery` is set to `true`, Cube.js will renew all `refreshKey` for query and query result itself in foreground. However if `refreshKey` or `refreshKeyRenewalThreshold` don't indicate that there's a need for update this setting has no effect. The default value is `false`.
33-
- `ungrouped`: If `ungrouped` is set to `true` no `GROUP BY` statement will be added to the query and raw results after filtering and joining will be returned without grouping.
34-
By default `ungrouped` query requires to pass primary key as a dimension of every cube involved in query for security purpose.
35-
To disable this behavior please see [allowUngroupedWithoutPrimaryKey](@cubejs-backend-server-core#options-reference-allow-ungrouped-without-primary-key) server option.
32+
- `renewQuery`: If `renewQuery` is set to `true`, Cube.js will renew all `refreshKey` for queries and query results in the foreground. However if the `refreshKey` or `refreshKeyRenewalThreshold` don't indicate that there's a need for an update this setting has no effect. The default value is `false`.
33+
- `ungrouped`: If `ungrouped` is set to `true` no `GROUP BY` statement will be added to the query. Instead, the raw results after filtering and joining will be returned without grouping.
34+
By default `ungrouped` queries require a primary key as a dimension of every cube involved in the query for security purposes.
35+
To disable this behavior please see the [allowUngroupedWithoutPrimaryKey](@cubejs-backend-server-core#options-reference-allow-ungrouped-without-primary-key) server option.
3636

3737
```js
3838
{
@@ -60,7 +60,7 @@ To disable this behavior please see [allowUngroupedWithoutPrimaryKey](@cubejs-ba
6060

6161
### Default order
6262

63-
If `order` property is not specified in the query, Cube.js sorts results by default using the following rules:
63+
If the `order` property is not specified in the query, Cube.js sorts results by default using the following rules:
6464

6565
- The first time dimension with granularity, ascending. If no time dimension with granularity exists...
6666
- The first measure, descending. If no measure exists...
@@ -70,11 +70,11 @@ If `order` property is not specified in the query, Cube.js sorts results by defa
7070

7171
A filter is a Javascript object with the following properties:
7272

73-
- `member`: Dimension or measure to be used in the filter, for example: `Stories.isDraft`. See below on difference on filtering dimensions vs filtering measures.
74-
- `operator`: An operator to be used in filter. Only some operators are available for measures, for dimensions available operators depend on the type
73+
- `member`: Dimension or measure to be used in the filter, for example: `Stories.isDraft`. See below on difference between filtering dimensions vs filtering measures.
74+
- `operator`: An operator to be used in the filter. Only some operators are available for measures. For dimensions the available operators depend on the type
7575
of the dimension. Please see the reference below for the full list of available
7676
operators.
77-
- `values`: An array of values for the filter. Values must be of type String. If you need to pass a date, pass it as a string in `YYYY-MM-DD`.
77+
- `values`: An array of values for the filter. Values must be of type String. If you need to pass a date, pass it as a string in `YYYY-MM-DD` format.
7878

7979
#### Filtering Dimensions vs Filtering Measures
8080
Filters are applied differently to dimensions and measures.
@@ -83,7 +83,7 @@ When you filter on a dimension, you are restricting the raw data before any calc
8383
When you filter on a measure, you are restricting the results after the measure has been calculated.
8484

8585
## Filters Operators
86-
Only some operators are available for measures. For dimensions available operators are depend on the [type of the dimension](types-and-formats#dimensions-types).
86+
Only some operators are available for measures. For dimensions, the available operators depend on the [type of the dimension](types-and-formats#dimensions-types).
8787

8888
### equals
8989

@@ -102,7 +102,7 @@ Use it when you need an exact match. It supports multiple values.
102102

103103
### notEquals
104104

105-
An opposite operator of `equals`. It supports multiple values.
105+
The opposite operator of `equals`. It supports multiple values.
106106

107107
* Applied to measures.
108108
* Dimension types: `string`, `number`, `time`.
@@ -117,7 +117,7 @@ An opposite operator of `equals`. It supports multiple values.
117117

118118
### contains
119119

120-
`contains` filter acts as a wildcard case insensitive `LIKE` operator. In the majority of SQL backends it uses `ILIKE` operator with values being surrounded by `%`. It supports multiple values.
120+
The `contains` filter acts as a wildcard case insensitive `LIKE` operator. In the majority of SQL backends it uses `ILIKE` operator with values being surrounded by `%`. It supports multiple values.
121121

122122
* Dimension types: `string`.
123123

@@ -131,7 +131,7 @@ An opposite operator of `equals`. It supports multiple values.
131131

132132
### notContains
133133

134-
An opposite operator of `contains`. It supports multiple values.
134+
The opposite operator of `contains`. It supports multiple values.
135135

136136
* Dimension types: `string`.
137137

@@ -145,7 +145,7 @@ An opposite operator of `contains`. It supports multiple values.
145145

146146
### gt
147147

148-
The `gt` operator means **greater than** and is used with measures or dimensions of type number.
148+
The `gt` operator means **greater than** and is used with measures or dimensions of type `number`.
149149

150150
* Applied to measures.
151151
* Dimension types: `number`.
@@ -160,7 +160,7 @@ The `gt` operator means **greater than** and is used with measures or dimensions
160160

161161
### gte
162162

163-
The `gte` operator means **greater than or equal to** and is used with measures or dimensions of type number.
163+
The `gte` operator means **greater than or equal to** and is used with measures or dimensions of type `number`.
164164

165165
* Applied to measures.
166166
* Dimension types: `number`.
@@ -175,7 +175,7 @@ The `gte` operator means **greater than or equal to** and is used with measures
175175

176176
### lt
177177

178-
The `lt` operator means **less than** and is used with measures or dimensions of type number.
178+
The `lt` operator means **less than** and is used with measures or dimensions of type `number`.
179179

180180
* Applied to measures.
181181
* Dimension types: `number`.
@@ -190,7 +190,7 @@ The `lt` operator means **less than** and is used with measures or dimensions of
190190

191191
### lte
192192

193-
The `lte` operator means **less than or equal to** and is used with measures or dimensions of type number.
193+
The `lte` operator means **less than or equal to** and is used with measures or dimensions of type `number`.
194194

195195
* Applied to measures.
196196
* Dimension types: `number`.
@@ -220,7 +220,7 @@ need to pass `values` for this operator.
220220

221221
### notSet
222222

223-
An opposite to `set` operator. It checks whether the value of the member **is** `NULL`. You don't
223+
An opposite to the `set` operator. It checks whether the value of the member **is** `NULL`. You don't
224224
need to pass `values` for this operator.
225225

226226
* Applied to measures.
@@ -235,7 +235,7 @@ need to pass `values` for this operator.
235235

236236
### inDateRange
237237

238-
Operator `inDateRange` used to filter a time dimension into specific date range. The values must be an array of dates with following format '2015-01-01'. If only one date specified the filter would be set exactly to this date.
238+
The operator `inDateRange` is used to filter a time dimension into a specific date range. The values must be an array of dates with the following format 'YYYY-MM-DD'. If only one date specified the filter would be set exactly to this date.
239239

240240
There is a convient way to use date filters with grouping - [learn more about
241241
timeDimensions query property here](#time-dimensions-format)
@@ -281,7 +281,7 @@ values should be an array of one element in `YYYY-MM-DD` format.
281281

282282
### afterDate
283283

284-
The same as `beforeDate`, but used to get all results after specific date.
284+
The same as `beforeDate`, but is used to get all results after a specific date.
285285

286286

287287
* Dimension types: `time`.
@@ -297,16 +297,16 @@ The same as `beforeDate`, but used to get all results after specific date.
297297

298298
## Time Dimensions Format
299299

300-
Since grouping and filtering by a time dimension is quite a common case, Cube.js provides a convient shortcut to pass a dimension and a filter as a `timeDimension` property.
300+
Since grouping and filtering by a time dimension is quite a common case, Cube.js provides a convenient shortcut to pass a dimension and a filter as a `timeDimension` property.
301301

302302
- `dimension`: Time dimension name.
303303
- `dateRange`: An array of dates with the following format `YYYY-MM-DD` or in `YYYY-MM-DDTHH:mm:ss.SSS` format.
304304
Values should always be local and in query `timezone`.
305305
Dates in `YYYY-MM-DD` format are also accepted.
306-
Such dates padded to start and end of day if used in start and end of date range interval accordingly.
307-
If only one date specified it's equivalent to passing two same dates as a date range.
306+
Such dates are padded to the start and end of the day if used in start and end of date range interval accordingly.
307+
If only one date is specified it's equivalent to passing two of the same dates as a date range.
308308
You can also pass a string instead of array with relative date range, for example: `last quarter` or `last 360 days`.
309-
- `granularity`: A granularity for a time dimension. It supports following values `second`, `minute`, `hour`, `day`, `week`, `month`, `year`. If you pass `null` to the granularity, the Cube.js will only perform a filtering by specified time dimension, without grouping.
309+
- `granularity`: A granularity for a time dimension. It supports the following values `second`, `minute`, `hour`, `day`, `week`, `month`, `year`. If you pass `null` to the granularity, Cube.js will only perform filtering by a specified time dimension, without grouping.
310310

311311
```js
312312
{

0 commit comments

Comments
 (0)