power-bi 2.6.0 → 2.6.1
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.
- checksums.yaml +4 -4
- data/lib/power-bi/admin.rb +4 -21
- data/lib/power-bi/dataset.rb +1 -1
- data/lib/power-bi/profile.rb +1 -1
- data/lib/power-bi/report.rb +1 -1
- data/lib/power-bi/tenant.rb +63 -0
- data/lib/power-bi/workspace.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad399c89996fb5bc9d8503233c2827c7f57366cd849e16c3e780048a8f1973ae
|
|
4
|
+
data.tar.gz: a2ffbbac846e08cc9e9fefd52b86e9a996802ec51e5a4f748f0ab8c8799f4b87
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88c0f92c90ae4392b20ea6a85f7be737302857735135b73cba780c2afd31349b672772ac2d95e38fa40a4cd01d8ae226edf49acab7caf4219c118c99021559c8
|
|
7
|
+
data.tar.gz: 78f8483bfc046ef783b852ec66b6ce7c5645c123e793dd475416de440ac83fb2ae65f3968553e02e8474e983ba06f9b27f32bf0e6ff57f3c406586b8e693427c
|
data/lib/power-bi/admin.rb
CHANGED
|
@@ -30,28 +30,11 @@ module PowerBI
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def get_workspaces(filter: nil, expand: nil)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
base_params = {}
|
|
34
|
+
base_params[:$filter] = filter if filter
|
|
35
|
+
base_params[:$expand] = expand if expand
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
nr_records = 5000
|
|
40
|
-
count = 0
|
|
41
|
-
|
|
42
|
-
data = []
|
|
43
|
-
|
|
44
|
-
loop do
|
|
45
|
-
params[:$top] = nr_records
|
|
46
|
-
params[:$skip] = count
|
|
47
|
-
resp = @tenant.get(url, params)
|
|
48
|
-
data += resp[:value]
|
|
49
|
-
batch_count = resp[:value].size
|
|
50
|
-
count += batch_count
|
|
51
|
-
break if batch_count < nr_records
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
data
|
|
37
|
+
@tenant.get_paginated('/admin/groups', base_params: base_params)
|
|
55
38
|
end
|
|
56
39
|
|
|
57
40
|
def force_delete_workspace_by_workspace_name(user_email, workspace_name)
|
data/lib/power-bi/dataset.rb
CHANGED
data/lib/power-bi/profile.rb
CHANGED
data/lib/power-bi/report.rb
CHANGED
data/lib/power-bi/tenant.rb
CHANGED
|
@@ -198,6 +198,69 @@ module PowerBI
|
|
|
198
198
|
JSON.parse(response.body, symbolize_names: true)
|
|
199
199
|
end
|
|
200
200
|
|
|
201
|
+
# Fetches paginated data from the Power BI API using OData-style pagination.
|
|
202
|
+
#
|
|
203
|
+
# Power BI API has a documented limit of 5000 records per request.
|
|
204
|
+
# This method handles pagination automatically by:
|
|
205
|
+
# 1. Requesting 5000 records at a time using $top and $skip
|
|
206
|
+
# 2. If exactly 5000 records are returned, fetching the next page
|
|
207
|
+
# 3. Accumulating all results across pages
|
|
208
|
+
# 4. Deduplicating records by ID (to handle insertions between requests)
|
|
209
|
+
#
|
|
210
|
+
# Note: $skip-based pagination is not fully protected against deletions
|
|
211
|
+
# between requests (a deleted record may cause a subsequent record to go
|
|
212
|
+
# unseen). This risk is acceptable given the short pagination window.
|
|
213
|
+
MAX_PAGE_SIZE = 5000
|
|
214
|
+
MAX_ITERATIONS = 100
|
|
215
|
+
def get_paginated(url, page_size: MAX_PAGE_SIZE, base_params: {}, use_profile: true, max_iterations: MAX_ITERATIONS)
|
|
216
|
+
page_size = [page_size, MAX_PAGE_SIZE].min
|
|
217
|
+
|
|
218
|
+
skip = 0
|
|
219
|
+
all_data = []
|
|
220
|
+
iteration = 0
|
|
221
|
+
|
|
222
|
+
loop do
|
|
223
|
+
iteration += 1
|
|
224
|
+
if iteration > max_iterations
|
|
225
|
+
log "WARNING: Reached maximum iteration limit (#{max_iterations}). " \
|
|
226
|
+
"Fetched #{all_data.size} records so far. This may indicate an API issue or " \
|
|
227
|
+
"an extremely large dataset. Consider using API filters to reduce the result set.",
|
|
228
|
+
level: :warn
|
|
229
|
+
break
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
params = base_params.merge({
|
|
233
|
+
'$top' => page_size,
|
|
234
|
+
'$skip' => skip
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
log "Fetching paginated data from #{url} (skip: #{skip}, top: #{page_size}, iteration: #{iteration})"
|
|
238
|
+
|
|
239
|
+
resp = get(url, params, use_profile: use_profile)
|
|
240
|
+
batch = resp[:value] || []
|
|
241
|
+
all_data += batch
|
|
242
|
+
batch_count = batch.size
|
|
243
|
+
|
|
244
|
+
log "Received #{batch_count} records (total so far: #{all_data.size})"
|
|
245
|
+
|
|
246
|
+
# If we got fewer records than requested, we've reached the last page
|
|
247
|
+
break if batch_count < page_size
|
|
248
|
+
|
|
249
|
+
skip += batch_count
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Deduplicate by ID to handle any records that were inserted between requests.
|
|
253
|
+
# Insertions before the current $skip position shift items right, which can
|
|
254
|
+
# cause duplicates across pages.
|
|
255
|
+
deduplicated_data = all_data.uniq{|r| r[:id]}
|
|
256
|
+
|
|
257
|
+
if deduplicated_data.size < all_data.size
|
|
258
|
+
log "Removed #{all_data.size - deduplicated_data.size} duplicate records during deduplication"
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
deduplicated_data
|
|
262
|
+
end
|
|
263
|
+
|
|
201
264
|
private
|
|
202
265
|
|
|
203
266
|
def add_spp_header(req)
|
data/lib/power-bi/workspace.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: power-bi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.6.
|
|
4
|
+
version: 2.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lode Cools
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-02-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|