{% extends 'portal.html' %} {% block title %}Welcome {{ name }}{% endblock %} {% block content %}
Tools

The PBSHM Core comes with a few tools which are available via the mechanic and timekeeper modules. The mechanic module enables easy interaction with the PBSHM Schema and your local database. The timekeeper module enables conversions from native python datetime object into the UTC nanoseconds since epoch time stored within the database.

To retrieve all versions of the PBSHM Schema available for installation, use the following cli command:

flask mechanic versions

To create a new collection with the latest version of the PBSHM Schema installed within the collection, use the following command:

flask mechanic new-structure-collection collection-name

To create a new collection with a specific version of the PBSHM Schema installed within the collection, use the following command:

flask mechanic new-structure-collection collection-name --version=v1.0

To convert a python datetime object into UTC nanoseconds since epoch, use the following code:


from datetime import datetime
from pbshm.timekeeper import datetime_to_nanoseconds_since_epoch

now = datetime.now()
nanoseconds = datetime_to_nanoseconds_since_epoch(now)
    

To convert a UTC nanoseconds since epoch into a native python datetime object, use the following code:


from pbshm.timekeeper import nanoseconds_since_epoch_to_datetime

nanoseconds = 1706884924912888000
date_time = nanoseconds_since_epoch_to_datetime(nanoseconds)
    
Bug reporting

If you encounter any issues/bugs with the system or the instructions above, please raise an issue through the issues system on GitHub.

{% endblock %}