Skip to content

Commit 3d7e7d8

Browse files
authored
Update the msgraph-sdk-go version from v0.38.0 to v1.84.0 and added new tables Closes #7 (#67)
1 parent 7d2e653 commit 3d7e7d8

34 files changed

Lines changed: 6456 additions & 279 deletions

docs/tables/microsoft365_drive.md

Lines changed: 145 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,148 @@ from
136136
where
137137
user_id = 'test@org.onmicrosoft.com'
138138
and filter = 'name eq ''Steampipe''';
139-
```
139+
```
140+
141+
### Explore drive quota and storage information
142+
Analyze drive storage usage and quota information to understand how much space users are consuming and monitor storage patterns across your organization.
143+
144+
```sql+postgres
145+
select
146+
name,
147+
drive_type,
148+
quota ->> 'used' as used_bytes,
149+
quota ->> 'total' as total_bytes,
150+
quota ->> 'remaining' as remaining_bytes,
151+
quota ->> 'state' as quota_state,
152+
round((quota ->> 'used')::bigint / 1024.0 / 1024.0, 2) as used_mb,
153+
round((quota ->> 'total')::bigint / 1024.0 / 1024.0 / 1024.0, 2) as total_gb,
154+
round((quota ->> 'remaining')::bigint / 1024.0 / 1024.0 / 1024.0, 2) as remaining_gb
155+
from
156+
microsoft365_drive
157+
where
158+
user_id = 'test@org.onmicrosoft.com'
159+
and quota is not null;
160+
```
161+
162+
```sql+sqlite
163+
select
164+
name,
165+
drive_type,
166+
json_extract(quota, '$.used') as used_bytes,
167+
json_extract(quota, '$.total') as total_bytes,
168+
json_extract(quota, '$.remaining') as remaining_bytes,
169+
json_extract(quota, '$.state') as quota_state,
170+
round(json_extract(quota, '$.used') / 1024.0 / 1024.0, 2) as used_mb,
171+
round(json_extract(quota, '$.total') / 1024.0 / 1024.0 / 1024.0, 2) as total_gb,
172+
round(json_extract(quota, '$.remaining') / 1024.0 / 1024.0 / 1024.0, 2) as remaining_gb
173+
from
174+
microsoft365_drive
175+
where
176+
user_id = 'test@org.onmicrosoft.com'
177+
and quota is not null;
178+
```
179+
180+
### List drives with SharePoint integration
181+
Explore drives that have SharePoint integration by examining the sharepoint_ids field. This is useful for understanding which drives are connected to SharePoint sites and document libraries.
182+
183+
```sql+postgres
184+
select
185+
name,
186+
id,
187+
drive_type,
188+
sharepoint_ids,
189+
owner,
190+
created_date_time,
191+
web_url
192+
from
193+
microsoft365_drive
194+
where
195+
user_id = 'test@org.onmicrosoft.com'
196+
and sharepoint_ids is not null;
197+
```
198+
199+
```sql+sqlite
200+
select
201+
name,
202+
id,
203+
drive_type,
204+
sharepoint_ids,
205+
owner,
206+
created_date_time,
207+
web_url
208+
from
209+
microsoft365_drive
210+
where
211+
user_id = 'test@org.onmicrosoft.com'
212+
and sharepoint_ids is not null;
213+
```
214+
215+
### Get drive details with owner information
216+
Explore detailed drive information including owner details and creation information to understand drive ownership and management within your organization.
217+
218+
```sql+postgres
219+
select
220+
name,
221+
id,
222+
drive_type,
223+
owner,
224+
created_by,
225+
last_modified_by,
226+
created_date_time,
227+
last_modified_date_time,
228+
web_url
229+
from
230+
microsoft365_drive
231+
where
232+
user_id = 'test@org.onmicrosoft.com';
233+
```
234+
235+
```sql+sqlite
236+
select
237+
name,
238+
id,
239+
drive_type,
240+
owner,
241+
created_by,
242+
last_modified_by,
243+
created_date_time,
244+
last_modified_date_time,
245+
web_url
246+
from
247+
microsoft365_drive
248+
where
249+
user_id = 'test@org.onmicrosoft.com';
250+
```
251+
252+
### List drives by type with storage analysis
253+
Analyze drives by type (personal, business, documentLibrary) and their storage usage to understand the distribution of different drive types and their storage patterns.
254+
255+
```sql+postgres
256+
select
257+
drive_type,
258+
count(*) as drive_count,
259+
round(avg((quota ->> 'used')::bigint / 1024.0 / 1024.0), 2) as avg_used_mb,
260+
round(avg((quota ->> 'total')::bigint / 1024.0 / 1024.0 / 1024.0), 2) as avg_total_gb
261+
from
262+
microsoft365_drive
263+
where
264+
user_id = 'test@org.onmicrosoft.com'
265+
and quota is not null
266+
group by
267+
drive_type;
268+
```
269+
270+
```sql+sqlite
271+
select
272+
drive_type,
273+
count(*) as drive_count,
274+
round(avg(json_extract(quota, '$.used') / 1024.0 / 1024.0), 2) as avg_used_mb,
275+
round(avg(json_extract(quota, '$.total') / 1024.0 / 1024.0 / 1024.0), 2) as avg_total_gb
276+
from
277+
microsoft365_drive
278+
where
279+
user_id = 'test@org.onmicrosoft.com'
280+
and quota is not null
281+
group by
282+
drive_type;
283+
```

0 commit comments

Comments
 (0)