Skip to main content

This provides a set of SQLAlchemy ORM models for the ISPyB database.

Installation

Install from pypi ispyb-models:

pip install ispyb-models

Basic Usage

from ispyb import models

dataCollection = models.DataCollection(
    ...
)

ses.add(dataCollection)
ses.commit()

...

datacollections = (
    ses.query(
        models.DataCollection
    ).filter(models.DataCollection.dataCollectionId == 1)
    ).first()
)

Generate a new version

To update the models you need to run the workflow Update Models through GitHub Actions panel. This will create a new branch with models matching the latest DB release and create a pull request for merge this branch into main. Before merging there are some things you need to do:

  • Make sure py-ispyb tests still pass with these new models
  • Update HISTORY.md to reflect the changes
  • Bump version number with bump2version

⚠️ Do not edit the output file yourself

The resulting _auto_db_schema.py should not be edited (other than automatic formatting with black or sorting of imports with isort). All models are imported into and accessed via the __init__.py. Any modifications, e.g. injecting additional relationships between models should be done here.

⚠️ [for local test] Manually update the DB schema

Checkout the specific tag for a given ispyb-database version:

$ git clone -b v1.18.1 https://github.com/ispyb/ispyb-database.git
$ # or, if you have an existing copy of the repository:
$ git checkout v1.18.1

Apply the schema patch in patches/circular_references.patch to avoid circular foreign key references:

$ patch -p1 < ispyb-models/patches/circular_references.patch

Then run the ispyb-database build.sh script to generate the database:

$ sh build.sh

Generate the models with sqlacodegen in src/ispyb/models/:

. generate_models.sh

Metadata

Release files for ispyb-models-pyispyb 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ispyb-models-pyispyb 1.3.2
File Size Uploaded
ispyb_models_pyispyb-1.3.2.tar.gz 38.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ispyb-models-pyispyb 1.3.2
File Interpreter ABI Platform
ispyb_models_pyispyb-1.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 75.3 kB

Release files / ispyb_models_pyispyb-1.3.2.tar.gz

Download URL ispyb_models_pyispyb-1.3.2.tar.gz
Size 38.0 kB
Tags Source
SHA-256 checksum
How to use checksums
34fc7648bf9cb25996356308912ef01d99ba57337aa0cbee96022c290fea5e44
BLAKE2b-256 checksum
How to use checksums
2702df9ac01e5a2185e4b182333b8cfc80411a026c56a3807df8da63aac4c526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / ispyb_models_pyispyb-1.3.2-py3-none-any.whl

Download URL ispyb_models_pyispyb-1.3.2-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7689bfebe355223bf105a3f3838506f942150d0974d9a1acb6efc5811370d253
BLAKE2b-256 checksum
How to use checksums
c00dce23d35f0ee383fb6572b27051431eef583efd08b5f99a71b7cd8e37eb43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page