DSMS Config Schema

DSMS Config Schema#

The Configuration class for the DSMS Python SDK is designed to handle various settings required to connect and interact with a DSMS instance. This documentation provides a detailed overview of the configurable properties, their types, defaults, and descriptions.

This section describes the configuration properties for the DSMS Python SDK.

Configuration Fields#

Field Name

Description

Type

Default

Property Namespace

Required/Optional

Environment Variable

Host URL

URL of the DSMS instance to connect.

AnyUrl

Not Applicable

host_url

Required

DSMS_HOST_URL

Request timeout

Timeout in seconds until the request to the DSMS is timed out.

int

120

request_timeout

Optional

DSMS_REQUEST_TIMEOUT

SSL verify

Whether the SSL of the DSMS shall be verified during connection.

bool

True

ssl_verify

Optional

DSMS_SSL_VERIFY

Username

User name for connecting to the DSMS instance

Optional[SecretStr]

None

username

Optional

DSMS_USERNAME

Password

Password for connecting to the DSMS instance

Optional[SecretStr]

None

password

Optional

DSMS_PASSWORD

Token

JWT bearer token for connecting to the DSMS instance

Optional[SecretStr]

None

token

Optional

DSMS_TOKEN

Ping Backend

Check whether the host is a DSMS instance or not.

bool

True

ping_backend

Optional

DSMS_PING_BACKEND

Auto fetch KTypes

Whether the KTypes of the DSMS should be fetched automatically when the session is started. They will be fetched if requested and cached in memory.

bool

True

auto_fetch_ktypes

Optional

DSMS_AUTO_FETCH_KTYPES

Auto refresh

Determines whether local objects like KItem, KType, and AppConfig should automatically update with the latest backend data after a successful commit.

bool

True

auto_refresh

Optional

DSMS_AUTO_REFRESH

Always refetch KTypes

Whether the KTypes of the DSMS should be refetched every time used in the SDK. This can be helpful if the SDK is integrated in a service and the KTypes are updated.

WARNING: This might lead to performance issues.

bool

False

always_refetch_ktypes

Optional

DSMS_ALWAYS_REFETCH_KTYPES

Strict validation

Whether the validation of custom properties shall be strict. Disabling this might be helpful when, for example, the schema of a KType has been changed and the custom properties are not compatible anymore and should be updated accordingly.

bool

True

strict_validation

Optional

DSMS_STRICT_VALIDATION

Enable auto reauth

Whether to automatically reauthenticate with username and password when the token is expired.

bool

True

enable_auto_reauth

Optional

DSMS_ENABLE_AUTO_REAUTH

Encoding

General encoding to be used for reading/writing serializations.

str

"utf-8"

encoding

Optional

DSMS_ENCODING

Datetime format

Datetime format used in the DSMS instance.

str

"%Y-%m-%dT%H:%M:%S.%f"

datetime_format

Optional

DSMS_DATETIME_FORMAT

KItem repository

Repository of the triplestore for KItems in the DSMS

str

"knowledge"

kitem_repo

Optional

DSMS_KITEM_REPO

SPARQL Object for units

Class and Module specification in order to retrieve the units.

str

dsms.knowledge.semantics.units.sparql:UnitSparqlQuery

units_sparql_object

Optional

DSMS_UNITS_SPARQL_OBJECT

Individual Slugs

When set to True, the slugs of the KItems will receive the first few characters of the KItem-id, when the slug is derived automatically from the KItem-name.

bool

True

individual_slugs

Optional

DSMS_INDIVIDUAL_SLUGS

Display units

Whether the custom properties or the dataframe columns shall directly reveal their unit when printed. WARNING: This might lead to performance issues.

bool

False

display_units

Optional

DSMS_DISPLAY_UNITS

Autocomplete units

When a unit is fetched but does not hold a symbol next to its URI, it shall be fetched from the respective ontology (which is general side effect from the units_sparql_object).

WARNING: This might lead to performance issues.

bool

True

autocomplete_units

Optional

DSMS_AUTOCOMPLETE_UNITS

QUDT units

URI of the QUDT unit ontology

str

"http://qudt.org/2.1/vocab/unit"

qudt_units

Optional

DSMS_QUDT_UNITS

QUDT Quantity Kinds

URI of the QUDT quantity kind ontology

str

"http://qudt.org/vocab/quantitykind/"

qudt_quantity_kinds

Optional

DSMS_QUDT_QUANTITY_KINDS

Hide properties

Properties to hide while printing, e.g {'external_links'}

Set[str]

{}

hide_properties

Optional

DSMS_HIDE_PROPERTIES

Log level

Logging level

str

None

log_level

Optional

DSMS_LOG_LEVEL

Example Usage#

from dsms import DSMS


config = DSMS(
    host_url="https://dsms.example.com",
    request_timeout=30,
    ssl_verify=True,
    username="****",
    password="****",
    token=None,
    ping_backend=True,
    individual_slugs=True,
    encoding="utf-8",
    datetime_format="%Y-%m-%dT%H:%M:%S.%f",
    display_units=False,
    autocomplete_units=True,
    kitem_repo="knowledge-items",
    qudt_units="http://qudt.org/2.1/vocab/unit",
    qudt_quantity_kinds="http://qudt.org/vocab/quantitykind/",
    units_sparql_object="dsms.knowledge.semantics.units.sparql:UnitSparqlQuery",
    hide_properties={"external_links"},
    log_level="INFO",
)

print(dsms.config)