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.7.tar.gz (23.7 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.7-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cqlalchemy-0.0.7.tar.gz
  • Upload date:
  • Size: 23.7 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.7.tar.gz
Algorithm Hash digest
SHA256 056fb94defdd82b68d5a2e565814a52cd9efafac2e66bd26f2961123b18da551
MD5 78e4794ff7fb1e14f40283620efe99cd
BLAKE2b-256 0c1a37f6408584a51a04703f635b797ebe9551080b1527f098a4e2a87651cfc0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cqlalchemy-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 27.2 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b76f9126f5f1058cc816d827aea338691e9328ec7fb019887145d2bc44c9e8c8
MD5 9a720c6fc712fa0d4fa27b835c41c122
BLAKE2b-256 88a414a15a9f2c67e32af8a2d769f7d463d70e4ca64810a3199429e41fada663

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