Skip to main content

library for constructing cql2-json queries and for generating libraries with multiple STAC extensions"

Project description

PyPI-Server

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.

Adding extensions

Add various STAC extensions to the builder. Leave blank to move to next step. In the below example we add the view, projection and mlm stac extensions.

Add extension schema by extension name

In some cases the extension schema can be guessed from an extension name

 % cqlbuild
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
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
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 :

Add extension by list of extension names and/or schema http endpoints

 % cqlbuild
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/sample_extension_list.txt
treating input sat like extension json-ld code and querying https://raw.githubusercontent.com/stac-extensions/sat/refs/heads/main/json-schema/schema.json
treating input sar like extension json-ld code and querying https://raw.githubusercontent.com/stac-extensions/sar/refs/heads/main/json-schema/schema.json
treating input eo like extension json-ld code and querying https://raw.githubusercontent.com/stac-extensions/eo/refs/heads/main/json-schema/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 (or file of fields): eo:snow_cover
Field to ignore (or file of fields): created
Field to ignore (or file of fields): ./tests/test_data/ignore_fields.txt
Field to ignore (or file of fields):

To prevent fields from being queryable through the generated STAC query interface.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cqlalchemy-0.0.8.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cqlalchemy-0.0.8-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file cqlalchemy-0.0.8.tar.gz.

File metadata

  • Download URL: cqlalchemy-0.0.8.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/20.6.0

File hashes

Hashes for cqlalchemy-0.0.8.tar.gz
Algorithm Hash digest
SHA256 9968f3de6c88da3fe3f843e8b2dbd73b1d62fdbe5d60110c6a39428e4e079094
MD5 45f32d61256048b6dbe8ef82c3dd0e5c
BLAKE2b-256 953dfef2b79c936d45f550d47552dcf3ccd303ef1a7e21df789391851f2ecd61

See more details on using hashes here.

File details

Details for the file cqlalchemy-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: cqlalchemy-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 27.3 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

Hashes for cqlalchemy-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0d8f50a6261e63576422136bf1fd74e70a5da0b6231d1a2c29403d09841a9024
MD5 e6c1edf319d4977ef2fa067a1cd75e66
BLAKE2b-256 77f4b1a33bce8ff8143ae4631f5fcd6dd2479eb83b845a882599525ec5114fef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page