Skip to content

Commit c524142

Browse files
committed
Add caching and warnings
1 parent 3cf3b8d commit c524142

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

fiboa_cli/conversion/duckdb.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
from pathlib import Path
44

55
import duckdb
6-
import pyarrow as pa
76
from vecorel_cli.encoding.geojson import VecorelJSONEncoder
8-
from vecorel_cli.parquet.types import get_pyarrow_field
97

108
from .fiboa_converter import FiboaBaseConverter
119

@@ -22,6 +20,11 @@ def convert(
2220
original_geometries=False,
2321
**kwargs,
2422
) -> str:
23+
if geoparquet_version is not None:
24+
self.warning("geoparquet_version is not supported for DuckDB-based converters and will always write GeoParquet v1.0")
25+
if not original_geometries:
26+
self.warning("original_geometries is not supported for DuckDB-based converters and will always write original geometries")
27+
2528
self.variant = variant
2629
cid = self.id.strip()
2730
if self.bbox is not None and len(self.bbox) != 4:
@@ -40,6 +43,15 @@ def convert(
4043
if urls is None:
4144
raise ValueError("No input files provided")
4245

46+
self.info("Getting file(s) if not cached yet")
47+
if cache:
48+
request_args = {}
49+
if self.avoid_range_request:
50+
request_args["block_size"] = 0
51+
urls = self.download_files(urls, cache, **request_args)
52+
elif self.avoid_range_request:
53+
self.warning("avoid_range_request is set, but cache is not used, so this setting has no effect")
54+
4355
selections = []
4456
geom_column = None
4557
for k, v in self.columns.items():

0 commit comments

Comments
 (0)