Metadata-Version: 2.1
Name: threedi-schema
Version: 0.214.5
Summary: The schema of 3Di schematization files
Home-page: https://github.com/nens/threedi-schema
Author: Nelen & Schuurmans
Author-email: info@nelen-schuurmans.nl
License: MIT
Classifier: Programming Language :: Python
Classifier: Framework :: Django
Requires-Python: >=3.7
Provides-Extra: test
Provides-Extra: cli
License-File: LICENSE

threedi-schema
==========================================


.. image:: https://img.shields.io/pypi/v/threedi-schema.svg
  :target: https://pypi.org/project/threedi-schema/

.. image:: https://github.com/nens/threedi-schema/actions/workflows/test.yml/badge.svg
	:alt: Github Actions status
	:target: https://github.com/nens/threedi-schema/actions/workflows/test.yml


The schema of 3Di schematisation files.

This project exposes:

- A ``ThreediDatabase`` object to interact with schematisation files.
- A ``ModelSchema`` object (``ThreediDatabase().schema``) for adapting
  schema versions (called "migration").
- The 3Di schema as SQLAlchemy models and python Enum classes.\*

\*This package exposes SQLAlchemy models of the
schematisation files directly. A minor release of this package may
change these models and will be backwards incompatible.
If the SQLAlchemy models are used, we strongly advise to fix the
minor version as follows: ``threedi-schema==0.214.*``. Otherwise, just
fixing the major version is sufficient.

Example
-------

The following code sample shows how you can upgrade a schematisation file::

    from threedi_schema import ThreediDatabase

    db = ThreediDatabase("<Path to your sqlite file>")
    db.schema.upgrade()


The following code sample shows how you can list Channel objects::

    from threedi_schema import models
    # NB: Ensure that you pin the minor version of threedi-schema
    # when using models (or constants).

    channels = db.get_session().query(models.Channel).all()


Command-line interface
----------------------

Migrate to the latest schema version::

    threedi_schema -s path/to/model.sqlite migrate 


Ensure presence of spatial indexes::

    threedi_schema -s path/to/model.sqlite index 


Installation
------------

Install with::

  $ pip install threedi-schema


Changelog of threedi-schema
===================================================


0.214.5 (2023-02-16)
--------------------

- Add SQLAlchemy 2.0 support and drop 1.3 support.


0.214.4 (2023-01-31)
--------------------

- Properly cleanup geo-tables in migration 214.


0.214.3 (2023-01-19)
--------------------

- Adapted versioning: prefix existing versions with 0.

- Fixed deprecation warnings of Geoalchemy2 0.13.0


0.214.2 (2023-01-17)
--------------------

- Fixed packaging (also include migrations).


0.214.1 (2023-01-17)
--------------------

- Fixed packaging.


0.214.0 (2023-01-17)
--------------------

- Initial project structure created with cookiecutter and
  https://github.com/nens/cookiecutter-python-template

- Ported code from threedi-modelchecker, rearranged into
  'domain', 'application', 'infrastructure', 'migrations'.
