Python
Python API documentation for the cql2 package. Install from PyPI:
API
cql2.Expr(cql2)
A CQL2 expression.
The cql2 can either be a cql2-text string, a cql2-json string, or a cql2-json dictionary.
Parameters:
-
cql2
(str | dict[str, Any]
) –The input CQL2
Examples:
>>> from cql2 import Expr
>>> expr = Expr("landsat:scene_id = 'LC82030282019133LGN00'")
>>> expr = Expr({"op":"=","args":[{"property":"landsat:scene_id"},"LC82030282019133LGN00"]})
from_path(path)
staticmethod
Reads CQL2 from a filesystem path.
Parameters:
-
path
(PathLike
) –The input path
Returns:
-
Expr
(Expr
) –The CQL2 expression
Examples:
to_json()
Converts this cql2 expression to a cql2-json dictionary.
Returns:
-
dict[str, Any]
–dict[str, Any]: The cql2-json
Examples:
to_sql()
Converts this cql2 expression to a SQL query.
Returns:
-
SqlQuery
(SqlQuery
) –The SQL query and parameters
Examples:
cql2.SqlQuery
A SQL query
params: list[str]
instance-attribute
The parameters, to use for binding.
query: str
instance-attribute
The query, with parameterized fields.