Skip to content

Commit

Permalink
fix: matching compressions should be checked when appending rasters (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelacruzb authored Mar 10, 2025
1 parent edcd4ff commit 0e30d11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions raster_loader/io/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,12 @@ def check_metadata_is_compatible(metadata, old_metadata):
f"({metadata['bands']} != {old_metadata['bands']})."
)

if metadata.get("compression") != old_metadata.get("compression"):
raise ValueError(
"Cannot append records to a table with different compression."
f"({metadata.get('compression')} != {old_metadata.get('compression')})."
)


def update_metadata(metadata, old_metadata):
"""Update a metadata object, combining it with another existing metadata object
Expand Down
7 changes: 6 additions & 1 deletion raster_loader/io/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ def band_rename_function(x):
exit()

metadata = rasterio_metadata(
file_path, bands_info, band_rename_function, exact_stats, basic_stats
file_path,
bands_info,
band_rename_function,
exact_stats,
basic_stats,
compress,
)

overviews_records_gen = rasterio_overview_to_records(
Expand Down

0 comments on commit 0e30d11

Please sign in to comment.