Skip to main content

ohsome filter to SQL

Build Status PyPI - Version LICENSE status: active

Try it out

# USAGE:
#   after running ohsome-filter-to-sql type in ohsome filter and hit enter
$ uvx ohsome-filter-to-sql
natural = tree and leaftype = broadleaf
('tags @> $1 AND tags @> $2', ('{"natural": "tree"}', '{"leaftype": "broadleaf"}'))

Installation

uv add ohsome-filter-to-sql

Usage

Python Library

from ohsome_filter_to_sql import ohsome_filter_to_sql

query, query_args = ohsome_filter_to_sql("natural = tree")

Command Line Interface (CLI)

uv run ohsome-filter-to-sql

Development Setup

uv run prek install  # pre-commit hooks

export OHSOME_FILTER_TO_SQL_SCHEMA=""
export OHSOME_FILTER_TO_SQL_DATABASE=""
export OHSOME_FILTER_TO_SQL_USER=""
export OHSOME_FILTER_TO_SQL_PASSWORD=""
export OHSOME_FILTER_TO_SQL_HOST="localhost"
export OHSOME_FILTER_TO_SQL_PORT="5432"
uv run pytest

To develop new features you will need a local instance of the ohsomeDB.

How to play around with the grammar?

Execute antlr4-parse, type in an ohsome filter and press ctlr+d.

antlr4-parse OFL.g4 root -tree
buildings=yes
(root:1 (expression:8 (tagMatch:1 (string:1 buildings) = (string:1 yes))) <EOF>)

ANTLR Lab can also be used to try out the grammar.

How to generating parser code?

When the grammar file has changed generate new Python code with antlr4 and move generated files to ohsome_filter_to_sql/.

uv run antlr4 -Dlanguage=Python3 OFL.g4 && mv *.py ohsome_filter_to_sql/

Release

This project uses SemVer.

To make a new release run ./scripts/release.sh <version number>.

Resources

Download files

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

Source Distribution

ohsome_filter_to_sql-0.12.0.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

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

ohsome_filter_to_sql-0.12.0-py3-none-any.whl (38.0 kB view details)

Uploaded Python 3

File details

Details for the file ohsome_filter_to_sql-0.12.0.tar.gz.

File metadata

  • Download URL: ohsome_filter_to_sql-0.12.0.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ohsome_filter_to_sql-0.12.0.tar.gz
Algorithm Hash digest
SHA256 fe3c511d394f12b3c4b38699584b01888f9043bc0ff41ca00a0c05887435c2b2
MD5 db3e610048e09caccefb4c74ce211982
BLAKE2b-256 9ac73b32fd7633031b739d0738828e3789ca0cbe40ba024b00d0222aabca80ac

See more details on using hashes here.

File details

Details for the file ohsome_filter_to_sql-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: ohsome_filter_to_sql-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 38.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ohsome_filter_to_sql-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cee394e4299ccee3cba1e719f3bf1bbace129421990a130a7a2e426392dd502
MD5 f086b2d5eb192dab82210b50d486c1e0
BLAKE2b-256 6536f482e6f4bd12089a9ed35299df5b0734184e0dd1286b942e93058b6d73f2

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 Sentry Error logging StatusPage Status page