Skip to content

Separate sql query builder & yaml parser package - #304

Open
spwoodcock wants to merge 2 commits into
developfrom
feat/separate-sql-query-builder
Open

Separate sql query builder & yaml parser package#304
spwoodcock wants to merge 2 commits into
developfrom
feat/separate-sql-query-builder

Conversation

@spwoodcock

@spwoodcock spwoodcock commented Apr 24, 2026

Copy link
Copy Markdown
Member

What type of PR is this?

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation
  • 🧑‍💻 Refactor
  • ✅ Test
  • 🤖 Build or CI
  • ❓ Other (please specify)

Related Issue :

Fixes #302

What does this PR do ?

  • As described in the issue, it would be useful for other tools to use the osm2pgsql SQL query builder here.
  • We also need the osm-raw-data YAML / JSON format parsing to feed in.
  • This PR moves the logic of parsing + query building to a separate package, that could be published standalone.
  • The builder and models are refactored in the code to use the new package.
  • The package will then be used as the basis for both raw-data-api and PostPass querying (which both use osm2pgsql db format).

Note

This PR basically just pulls out the existing builder.py logic verbatim, into a new file (in the standalone package).
It then attempts to wrap the extracted functionality in builder.py under ./src.
Hopefully nothing changed in the raw-data-api functionality as a result 🤞

How to test ?

  • This is where I really need a bit of help.
  • I can test the query builder logic works with a few unit tests.
  • But its hard to run the integration tests for the full raw-data-api stack, without ingesting an OSM database etc - setting this up locally.

AI Assistance

  • Yes
  • Model: Opus 4.6 LLM to help plan this, implement unit tests, and sanity check / review the implementation.

Checklist before requesting review :

  • 📖 Read the HOT Code of Conduct: https://docs.hotosm.org/code-of-conduct
  • 👷‍♀️ Create small PRs. In most cases, this will be possible.
  • ✅ Provide tests for your changes.
  • 📝 Use descriptive commit messages.
  • 📗 Update any related documentation and include any relevant screenshots.

[optional] What gif best describes this PR or how it makes you feel?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Move the query_builder logic to a standalone Python package

1 participant