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
Drops selected columns in the tables generated by selected resources,
446
-
unless the columns have a hint that makes them undroppable.
445
+
**How column selection works:**
447
446
448
-
You can use regexes to select resources and columns. Prepend the `re:` string to indicate a regex pattern.
447
+
1. **Resource resolution**: If `--from-resources` is specified, tables are grouped by resource using regex pattern matching. If omitted, all resources are considered.
448
+
449
+
2. **Table resolution**: If `--from-tables` is specified, only tables matching the pattern(s) within the selected resources are considered. If omitted, all tables from selected resources are considered.
450
+
451
+
3. **Column resolution**: Columns are matched against the specified pattern(s) within the selected tables. Only nullable columns without disqualifying hints can be dropped.
452
+
453
+
**Column safety rules:**
454
+
455
+
Only columns that meet ALL of the following criteria can be dropped:
456
+
- The column is nullable (can contain NULL values)
457
+
- The column does not have any disqualifying hints such as: `partition`, `cluster`, `unique`, `sort`, `primary_key`, `row_key`, `parent_key`, `root_key`, `merge_key`, `variant`, `hard_delete`, `dedup_sort`, or `incremental`
458
+
- After dropping the matched columns, at least one non-dlt internal column must remain in the table
459
+
460
+
**Filesystem destination note:**
461
+
462
+
For filesystem destination, column dropping is only supported for tables that have an associated `table_format` (e.g., Iceberg, Delta). Tables without a table format will be skipped with a notification.
463
+
464
+
**Example Output:**
465
+
466
+
```text
467
+
About to drop the following columns in dataset my_dataset in destination dlt.destinations.duckdb:
468
+
Selected schema: droppable_source
469
+
Selected resource(s): ['droppable_b']
470
+
Table(s) to be affected: ['droppable_b__items']
471
+
Column(s) to be dropped:
472
+
from table: droppable_b__items
473
+
columns: ['m']
474
+
Do you want to apply these changes?
475
+
```
476
+
477
+
**Pattern matching:**
478
+
479
+
You can use regexes to select resources, tables and columns. Prepend the `re:` string to indicate a regex pattern. For example:
480
+
- `--from-resources "re:^user"` matches all resources starting with "user"
481
+
- `--columns "re:.*_temp$"` matches all columns ending with "_temp"
Drops selected columns in the tables generated by selected resources,
511
-
unless the columns have a hint that makes them undroppable.
510
+
**How column selection works:**
512
511
513
-
You can use regexes to selectresources and columns. Prepend the `re:` string to indicate a regex pattern.
512
+
1. **Resource resolution**: If `--from-resources` is specified, tables are grouped by resource using regex pattern matching. If omitted, all resources are considered.
513
+
514
+
2. **Table resolution**: If `--from-tables` is specified, only tables matching the pattern(s) within the selected resources are considered. If omitted, all tables from selected resources are considered.
515
+
516
+
3. **Column resolution**: Columns are matched against the specified pattern(s) within the selected tables. Only nullable columns without disqualifying hints can be dropped.
517
+
518
+
**Column safety rules:**
519
+
520
+
Only columns that meet ALL of the following criteria can be dropped:
521
+
- The column is nullable (can contain NULL values)
522
+
- The column does not have any disqualifying hints such as: `partition`, `cluster`, `unique`, `sort`, `primary_key`, `row_key`, `parent_key`, `root_key`, `merge_key`, `variant`, `hard_delete`, `dedup_sort`, or `incremental`
523
+
- After dropping the matched columns, at least one non-dlt internal column must remain in the table
524
+
525
+
**Filesystem destination note:**
526
+
527
+
For filesystem destination, column dropping is only supported for tables that have an associated `table_format` (e.g., Iceberg, Delta). Tables without a table format will be skipped with a notification.
528
+
529
+
**Example Output:**
530
+
531
+
```text
532
+
About to drop the following columns in dataset my_dataset in destination dlt.destinations.duckdb:
533
+
Selected schema: droppable_source
534
+
Selected resource(s): ['droppable_b']
535
+
Table(s) to be affected: ['droppable_b__items']
536
+
Column(s) to be dropped:
537
+
from table: droppable_b__items
538
+
columns: ['m']
539
+
Do you want to apply these changes?
540
+
```
541
+
542
+
**Pattern matching:**
543
+
544
+
You can use regexes to selectresources, tables and columns. Prepend the `re:` string to indicate a regex pattern. For example:
545
+
- `--from-resources "re:^user"` matches all resources starting with "user"
546
+
- `--columns "re:.*_temp$"` matches all columns ending with "_temp".
0 commit comments