Upgrade from the Pre-refactor Dataset Module¶
This migration covers the dataset API changes introduced in fsspeckit 0.22.x. It targets code written against the immediately preceding public layout (pre-0.22) and shows how to reach the current canonical, class-based handler surface.
For the broader package-import migration (schema, logging, and utility relocations), see Move Your Package Imports. For every renamed symbol and legacy import path, see Deprecation and Legacy Imports.
Scope¶
Pre-0.22 to 0.22.x. If you are starting a new project, skip this page and read the Local Dataset Lifecycle tutorial instead.
What changed¶
The standalone dataset helper functions under fsspeckit.core.ext.dataset were
removed. The per-method merge entry points on DuckDBDatasetIO
(insert_dataset, upsert_dataset, update_dataset,
deduplicate_dataset, merge_parquet_dataset) were collapsed into the unified
merge method.
Removed APIs¶
These no longer exist and must be replaced:
| Removed API | Replacement |
|---|---|
fsspeckit.core.ext.dataset.write_pyarrow_dataset |
PyarrowDatasetIO.write_dataset |
fsspeckit.core.ext.dataset.insert_dataset |
DuckDBDatasetIO.merge(..., strategy="insert") |
fsspeckit.core.ext.dataset.upsert_dataset |
DuckDBDatasetIO.merge(..., strategy="upsert") |
fsspeckit.core.ext.dataset.update_dataset |
DuckDBDatasetIO.merge(..., strategy="update") |
fsspeckit.core.ext.dataset.deduplicate_dataset |
optimize_parquet_dataset on either backend |
DuckDBDatasetIO.merge_parquet_dataset |
DuckDBDatasetIO.merge |
DuckDBDatasetIO.insert_dataset |
DuckDBDatasetIO.merge(..., strategy="insert") |
DuckDBDatasetIO.upsert_dataset |
DuckDBDatasetIO.merge(..., strategy="upsert") |
DuckDBDatasetIO.update_dataset |
DuckDBDatasetIO.merge(..., strategy="update") |
DuckDBDatasetIO.deduplicate_dataset |
DuckDBDatasetIO.optimize_parquet_dataset |
Canonical handler surface¶
Both backends expose the same two entry points:
PyArrow¶
DuckDB¶
For handler selection guidance and how to interpret WriteDatasetResult and
MergeResult, see Dataset Handlers.
Write modes¶
write_dataset defaults to mode="append" on both backends. Pass
mode="overwrite" explicitly when you intend to replace an existing dataset.
Merge strategies¶
merge accepts strategy="insert", "update", or "upsert" on both backends.
The key_columns argument identifies the primary key for the merge.
Backend differences¶
The signatures share the same keyword surface, but execution differs:
| Aspect | PyArrow | DuckDB |
|---|---|---|
| Rewrite granularity | Partition pruning at the file level | SQL-based file rewrite |
| Streaming memory | Configurable via merge_max_memory_mb and related kwargs |
Managed by DuckDB's query engine |
partition_by on write_dataset |
Supported | Supported |
Several keyword arguments on merge (merge_chunk_size_rows,
merge_max_memory_mb, enable_streaming_merge) are meaningful for the PyArrow
backend and ignored by DuckDB. For the full parameter list and per-backend
behavior, see the generated signatures in
PyArrow Backend and
DuckDB Backend.
End-to-end migration example¶
Optimization and deduplication¶
optimize_parquet_dataset compacts small files and optionally deduplicates.
Both backends delegate planning to the shared fsspeckit.core.maintenance
layer, so the dry-run and group-planning output is identical; only the
read/concat/write step differs per backend.
For the full maintenance API, see Maintenance.
Legacy import paths¶
Old import paths and renamed symbols (for example DuckDBParquetHandler)
still work through the fsspeckit.utils facade but emit no long-term support
promise. Use canonical imports in all new and migrated code. For the complete
mapping, see
Deprecation and Legacy Imports.