You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FROM (SELECT UNNEST(vpax.analysis.Relationships) as rel FROM vpax)
272
-
GROUP BYrel.FromTableName, rel.ToTableName
273
-
ORDER BY RelationshipCount DESC;
274
-
```
275
-
276
192
**Measure catalog with expressions:**
277
193
```sql
278
194
SELECT
@@ -287,25 +203,11 @@ WHERE NOT meas.IsHidden
287
203
ORDER BYmeas.TableName, meas.MeasureName;
288
204
```
289
205
290
-
**Column type distribution:**
291
-
```sql
292
-
WITH vpax AS (
293
-
SELECT pbix2vpax('Adventure Works DW 2020.pbix') as analysis
294
-
)
295
-
SELECT
296
-
col.DataType,
297
-
COUNT(*) as ColumnCount,
298
-
SUM(col.TotalSize) /1024.0/1024.0as TotalSizeMB,
299
-
AVG(col.ColumnCardinality) as AvgCardinality
300
-
FROM (SELECT UNNEST(vpax.analysis.Columns) as col FROM vpax)
301
-
GROUP BYcol.DataType
302
-
ORDER BY ColumnCount DESC;
303
-
```
304
206
305
207
**Export to JSON for external analysis:**
306
208
```sql
307
209
COPY (
308
-
SELECTto_json(pbix2vpax('Adventure Works DW 2020.pbix'))
210
+
SELECT pbix2vpax('Adventure Works DW 2020.pbix')
309
211
) TO 'model_analysis.json';
310
212
```
311
213
@@ -348,82 +250,11 @@ SELECT * FROM model_b
348
250
ORDER BY ModelName, TableSize DESC;
349
251
```
350
252
351
-
**Find columns that could benefit from optimization:**
352
-
```sql
353
-
WITH vpax AS (
354
-
SELECT pbix2vpax('Adventure Works DW 2020.pbix') as analysis
355
-
)
356
-
SELECT
357
-
col.TableName,
358
-
col.ColumnName,
359
-
col.Encoding,
360
-
col.ColumnCardinality,
361
-
col.TotalSize/1024.0/1024.0as SizeMB,
362
-
CASE
363
-
WHEN col.Encoding='HASH'ANDcol.ColumnCardinality<1000
364
-
THEN 'Consider VALUE encoding'
365
-
WHEN col.ColumnCardinality>1000000
366
-
THEN 'Very high cardinality - review if needed'
367
-
ELSE 'OK'
368
-
END as Recommendation
369
-
FROM (SELECT UNNEST(vpax.analysis.Columns) as col FROM vpax)
370
-
WHEREcol.TotalSize>1048576-- Larger than 1MB
371
-
ORDER BYcol.TotalSizeDESC
372
-
LIMIT20;
373
-
```
374
-
375
-
**Relationship health check:**
376
-
```sql
377
-
SELECT
378
-
rel.FromTableName,
379
-
rel.ToTableName,
380
-
rel.RelationshipType,
381
-
rel.IsActive,
382
-
rel.CrossFilteringBehavior,
383
-
CASE
384
-
WHEN NOT rel.IsActive THEN 'Inactive relationship'
385
-
WHEN rel.CrossFilteringBehavior='BothDirections' THEN 'Bidirectional - review performance'
386
-
WHEN NOT rel.RelyOnReferentialIntegrity THEN 'RI not assumed - may impact performance'
387
-
ELSE 'OK'
388
-
END as HealthCheck
389
-
FROM (SELECT UNNEST(pbix2vpax('Adventure Works DW 2020.pbix').Relationships) as rel)
390
-
ORDER BYrel.FromTableName, rel.ToTableName;
391
-
```
392
-
393
-
## Running the tests
394
-
Different tests can be created for DuckDB extensions. The primary way of testing DuckDB extensions should be the SQL tests in `./test/sql`. These SQL tests can be run using:
395
-
```sh
396
-
make test
397
-
```
398
-
399
-
### Installing the deployed binaries
400
-
You will need to do two things to install your extension binaries from S3. Firstly, DuckDB should be launched with the
401
-
`allow_unsigned_extensions` option set to true. How to set this will depend on the client you're using. Some examples:
253
+
## Installing the extension
402
254
403
-
CLI:
404
-
```shell
405
-
duckdb -unsigned
406
-
```
407
-
408
-
Python:
409
-
```python
410
-
con = duckdb.connect(':memory:', config={'allow_unsigned_extensions' : 'true'})
411
-
```
412
-
413
-
NodeJS:
414
-
```js
415
-
db =newduckdb.Database(':memory:', {"allow_unsigned_extensions":"true"});
416
-
```
417
-
418
-
Secondly, you must set the repository endpoint in DuckDB to the HTTP URL of your bucket + version of the extension
419
-
you want to install. To do this, run the following SQL query in DuckDB:
420
-
```sql
421
-
SET custom_extension_repository='https://duckdb.pbix.info';
422
-
```
423
-
After running these steps, you can install and load your extension using the regular INSTALL/LOAD commands in DuckDB:
0 commit comments