Skip to content

retention duration support for ODCS in datacontract CLI #1033

@elcagupa

Description

@elcagupa

ODCS supports slaproperties -

  • property: retention
    value: 3
    unit: y

datacontract CLI supports
retention:
description: Data is retained for one year
period: P1Y
unlimited: false

datacontract cli throws an error when ODCS contract is used. The value in ODCS is integer but datacontract cli expects a string.

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/datacontract/data_contract.py", line 106, in test
execute_data_contract_test(data_contract, run, self._server, self._spark, self._duckdb_connection)
File "/usr/local/lib/python3.11/site-packages/datacontract/engines/data_contract_test.py", line 56, in execute_data_contract_test
run.checks.extend(create_checks(data_contract, server))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/datacontract/engines/data_contract_checks.py", line 61, in create_checks
checks.extend(to_servicelevel_checks(data_contract))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/datacontract/engines/data_contract_checks.py", line 948, in to_servicelevel_checks
check = to_servicelevel_retention_check(data_contract, sla)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/datacontract/engines/data_contract_checks.py", line 1055, in to_servicelevel_retention_check
seconds = _parse_iso8601_to_seconds(retention_period)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/datacontract/engines/data_contract_checks.py", line 1091, in _parse_iso8601_to_seconds
duration = duration.upper()
^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'upper'
ERROR:root:'int' object has no attribute 'upper'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions