Skip to main content

SQLAlchemy dialect for OGC WFS

Project description

SQLAlchemy dialect for OGC WFS

Coverage Reliability Rating Maintainability Rating Security Rating

SQLAlchemy dialect for OGC WFS as a Superset plugin.

Register the dialect

Create a requirements-local.txt file according to the superset documentation and insert following line:

superset_wfs_dialect

The dialect must then be registered in your superset config file, e.g. superset_config_docker.py when using the docker setup:

from sqlalchemy.dialects import registry
registry.register("wfs", "superset_wfs_dialect.dialect", "WfsDialect")

Start/restart superset and continue as described in the Start the application section.

Add a WFS database connection

  • select Settings > Database Connections
  • Click "+ Database"
  • select "OGC WFS" at the list of "Supported Databases"
  • insert the WFS URL into the host field (e.g. https://example.com/geoserver/wfs)
  • if the service is secured via BasicAuth, add username and password via the provided fields
  • if the service is secured via OIDC/OAUTH2, add the required parameters into the OAuth2 client information section
    • required fields: Client ID, Client Secret, Token Request URI
    • optional fields: Scopes
    • fields to ignore: Authorization Request URI (added by superset but not needed for the client credentials flow)
  • the WFS must support GeoJSON output (e.g outputFormat=application/json), and needs to support EPSG:4326 as coordinate reference system
  • create a dataset
  • create a chart/dashboard

Development

Prerequisites for development

  • Docker Engine >= version 28
  • python >= version 3.10.12
  • Checkout this project

Installation

For debugging and code completion run via terminal within the project root:

python3 -m venv .venv
source .venv/bin/activate
pip install -e .

or create a virtual environment via VS Code:

https://code.visualstudio.com/docs/python/python-tutorial#_create-a-virtual-environment.

Start superset with the registered plugin:

docker compose up -d --build

Integrate with a local Superset checkout (editable mode)

If you are developing this dialect together with a local Superset checkout, use an editable install inside the Superset container so code changes in this repository are picked up immediately.

  • Superset is checked out in a sibling directory, e.g.
    • ../superset
    • ../superset_wfs_dialect
  • Superset is started via Docker Compose in development mode

In the Superset checkout:

  1. Mount this repository into the Superset containers (e.g. /app/superset_wfs_dialect).

  2. Add this line to docker/requirements-local.txt:

    -e /app/superset_wfs_dialect
    
  3. Register the dialect in docker/pythonpath_dev/superset_config_docker.py:

    from sqlalchemy.dialects import registry
    registry.register("wfs", "superset_wfs_dialect.dialect", "WfsDialect")
    
  4. Set the DEBUGGER env variable for the superset service in superset/docker-compose.yml to "1" to enable debugging in the container.

  5. Restart the relevant services, for example:

    docker compose restart superset superset-worker superset-worker-beat
    

After restart, connect a database in Superset using a wfs://... SQLAlchemy URI as described above.

Debugging during development

Debugging can be activated via the VS Code during development using F5. Please note that the Python interpreter is selected from the previously created venv. Breakpoints set in VS Code are then taken into account.

Start the application

When in development mode, open http://localhost:8088/ . Otherwise, please open the corresponding URL to the installed superset instance.

Publishing a Development Version to PyPI

Requirements

  • You must be on the main branch
  • Your working directory must be clean (no uncommitted changes)
  • You have push access to the repository
  • A valid PYPI_TOKEN is configured in GitHub Secrets (used by the GitHub Actions workflow)

Releasing a new version

  1. Run the release script with the desired version number (e.g. 0.0.1):

    ./release.sh 0.0.1
    

    This will:

    • Update the version field in setup.py
    • Commit the change to main
    • Create a Git tag e.g. 0.0.1
    • Push the tag to GitHub
  2. The GitHub Actions workflow will be triggered by the tag:

    • It will build the package
    • Upload it to PyPI

Notes

  • Versions must follow the format X.Y.Z (e.g. 0.1.0)

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

superset_wfs_dialect-0.0.15.tar.gz (43.1 kB view details)

Uploaded Source

Built Distribution

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

superset_wfs_dialect-0.0.15-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

Details for the file superset_wfs_dialect-0.0.15.tar.gz.

File metadata

  • Download URL: superset_wfs_dialect-0.0.15.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for superset_wfs_dialect-0.0.15.tar.gz
Algorithm Hash digest
SHA256 078a1bd60c0aa350b97c48508c69e1eca8c5281fea05bc4ac2df2acbd51f91eb
MD5 1f25c2a2bd0eb5dd38cfada42566253c
BLAKE2b-256 cc0144163b90ae4d842620bc5fb75a2f8f2f346f68506443e7789f848820a2b7

See more details on using hashes here.

File details

Details for the file superset_wfs_dialect-0.0.15-py3-none-any.whl.

File metadata

File hashes

Hashes for superset_wfs_dialect-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 47b229294eab8914b9d7c020613ecbd5be5058cc244a6ca8ea4c66df92eb4aa9
MD5 72e66d125b067e10483f051a606c90a6
BLAKE2b-256 b7ae442d4c96e42d54db33323af9b6059ffc833f51d161e6e3a58f6e14b2f38d

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