library for constructing cql2-json queries and for generating libraries with multiple STAC extensions"
Project description
cqlalchemy
Library to help make CQL2-json queries a little easier!
STAC is a terrific specification for cataloging temporal/spatial data with an emphasis on providing queryable fields for searching that data. One of the ways to make complex queries is to use cql2-json.
This project provides two different functionalities. One is the cqlalchemy.stac.query module which provides query construction class (QueryBuilder) with the most popular extensions (eo, sar, sat, view, mlm).
The other functionality is a script that allows the user to build their own QueryBuilder class from extensions of their choosing, and allowing the opportunity to restrict the fields that can be queried (in the case where it isn't a required field and it's existence in the class might mislead the user).
cqlbuild
The cqlbuild is an interactive cli that allows for creating your own STAC cql2 query class.
Interactive cqlbuild
Add various STAC extensions to the builder. Leave blank to complete adding extensions and move to next step.
Add extension schema by extension name
In some cases the extension schema can be guessed from an extension name. In the below example we use the view extension name:
% cqlbuild --interactive
Enter extensions, either the path to a local file, a url or the extension json-ld name (sar, sat, etc):
STAC extension, raw schema url, local json extension schema file, local list of extensions or urls : view
treating input view like extension json-ld code and querying https://raw.githubusercontent.com/stac-extensions/view/refs/heads/main/json-schema/schema.json
STAC extension, raw schema url, local json extension schema file, local list of extensions or urls :
Add extension schema with local schema file
% cqlbuild --interactive
Enter extensions, either the path to a local file, a url or the extension json-ld name (sar, sat, etc):
STAC extension, raw schema url, local json extension schema file, local list of extensions or urls : ./tests/test_data/mlm.schema.json
STAC extension, raw schema url, local json extension schema file, local list of extensions or urls :
Add extension schema by raw schema endpoint
% cqlbuild --interactive
Enter extensions, either the path to a local file, a url or the extension json-ld name (sar, sat, etc):
STAC extension, raw schema url, local json extension schema file, local list of extensions or urls : https://stac-extensions.github.io/projection/v2.0.0/schema.json
STAC extension, raw schema url, local json extension schema file, local list of extensions or urls :
Omitting fields from the query class interface
Omit fields from the query class interface by adding a field to ignore or a file with a list of fields to ignore.
Enter stac fields to omit from api or a path with a list of fields to omit:
Field to ignore : eo:snow_cover
Field to ignore : created
Field to ignore :
To prevent fields from being queryable through the generated STAC query interface.
cqlbuild from definition file
Below is an example of a definition file for defining what extensions to use and what fields to ignore:
{
"extensions": [
"sat",
"sar",
"eo",
"view",
"landsat",
"./tests/test_data/mlm.schema.json",
"https://stac-extensions.github.io/projection/v2.0.0/schema.json"
],
"stac_fields_to_ignore": [
"view:sun_azimuth",
"view:sun_elevation",
"constellation"
]
}
It can be used in the cli as follows:
% cqlbuild --definition ./tests/test_data/sample_definition.json --output ./tests/test_data/fixed_up_class.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cqlalchemy-0.0.9.tar.gz.
File metadata
- Download URL: cqlalchemy-0.0.9.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/20.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56e8eed12d69146ad04ffb977bd23164e004671fd122f8ffb6ff9fbbf8163bf7
|
|
| MD5 |
4899d2419001c0b0d32759801e01f51a
|
|
| BLAKE2b-256 |
56bb18662df7cf708de41b888aa28b79f646301830e143c3848f4761b8574566
|
File details
Details for the file cqlalchemy-0.0.9-py3-none-any.whl.
File metadata
- Download URL: cqlalchemy-0.0.9-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/20.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd840bd1ac45ce057e20b50e38f92b776745ed753de993dc4c73fc3a74a61a05
|
|
| MD5 |
014c3d3a1d33389d58c8bcebd5af74f2
|
|
| BLAKE2b-256 |
0253c3d14d6020e9ca39772fb5632997055c40f939be9cb9eb2435ea7d0ba0d8
|