Skip to content

Commit 2de3756

Browse files
authored
feat: build collections from stac-geoparquet (#17)
- Closes #16
1 parent 1530e4a commit 2de3756

File tree

5 files changed

+135
-72
lines changed

5 files changed

+135
-72
lines changed

Cargo.lock

Lines changed: 68 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -e
44

5-
uv run maturin dev --uv && uv run pytest "$@"
5+
maturin dev --uv && pytest "$@"

src/duckdb.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
use crate::{Error, Result};
2-
use pyo3::{exceptions::PyException, prelude::*, types::PyDict};
2+
use pyo3::{
3+
exceptions::PyException,
4+
prelude::*,
5+
types::{PyDict, PyList},
6+
};
37
use stac_api::python::{StringOrDict, StringOrList};
48
use stac_duckdb::Client;
59
use std::sync::Mutex;
@@ -57,4 +61,13 @@ impl DuckdbClient {
5761
let dict = pythonize::pythonize(py, &item_collection)?;
5862
dict.extract()
5963
}
64+
65+
fn get_collections<'py>(&self, py: Python<'py>, href: String) -> PyResult<Bound<'py, PyList>> {
66+
let client = self
67+
.0
68+
.lock()
69+
.map_err(|err| PyException::new_err(err.to_string()))?;
70+
let collections = client.collections(&href).map_err(Error::from)?;
71+
pythonize::pythonize(py, &collections)?.extract()
72+
}
6073
}

0 commit comments

Comments
 (0)