Skip to content

Commit

Permalink
back to have metadata nullable to avoid to fill it to fate emptyu string
Browse files Browse the repository at this point in the history
  • Loading branch information
luipir committed Oct 30, 2023
1 parent 8700384 commit 79df278
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions raster_loader/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def array_to_quadbin_record(
# "block_height": height,
# "block_width": width,
# "attrs": json.dumps(attrs),
"metadata": "",
"metadata": None,
value_field: arr_bytes,
}

Expand Down Expand Up @@ -305,10 +305,10 @@ def raster_band_type(raster_dataset: rasterio.io.DatasetReader, band: int) -> st

def table_columns(bands: List[str]) -> List[Tuple[str, str, str]]:
columns = [
("block", "INTEGER", "NULLABLE"),
("block", "INTEGER", "REQUIRED"),
]
columns += [
("metadata", "STRING", "REQUIRED"),
("metadata", "STRING", "NULLABLE"),
# TODO: upgrade BQ client version and use 'JSON' type for 'attrs'
]
columns += [(band_name, "BYTES", "NULLABLE") for band_name in bands]
Expand Down Expand Up @@ -874,7 +874,7 @@ def table_creator(columns, clustering):
total_blocks = get_number_of_blocks(file_path)
# metadata["total_pixel_blocks"] = total_blocks # FIXME: for debugging purposes

if chunk_size is not None:
if chunk_size is None:
job = records_to_bigquery(
records_gen, table_id, dataset_id, project_id, client=client
)
Expand Down

0 comments on commit 79df278

Please sign in to comment.