Skip to main content

Helper for type-II Slowly Changing Dimensions, as well as ISO Json loading and dumping

Project description

Type Two

Provides a simple set of classes for handling type-II slowly changing dimension style data. Also provides helper classes for reading and writing JSON payloads with ISO-compliant dates.

Example Usage: TypeTwo

rows = [
   {"id": 1, "name": "Henry", "age": 34}
   {"id": 2, "name": "Fred", "age" : 42}
]

history = TypeType(rows, RowKey("id"), from_field = "start", to_field = "end")
iter(history)
>>> {"id": 1, "name": "Henry", "age": 34, "start": datetime(1900,1,1),  "end": datetime(2999,12,31)}
>>> {"id": 2, "name": "Fred",  "age": 42, "start": datetime(1900,1,1),  "end": datetime(2999,12,31)}


history += {"id": 1, "name": "Henry", "age": 37}
iter(history)
>>> {"id": 1, "name": "Henry", "age": 34, "start": datetime(1900,1,1),  "end": datetime(2022,6,12,3,0,0)}
>>> {"id": 1, "name": "Henry", "age": 37, "start": datetime(2022,6,12,3,0,0), "end": datetime(2999,12,31)}
>>> {"id": 2, "name": "Fred",  "age": 42, "start": datetime(1900,1,1),  "end": datetime(2999,12,31)}

history += [
   {"id": 1, "name": "Henry", "age": 99}
   {"id": 2, "name": "Fred", "age": 99}
]

iter(history)
>>> {"id": 1, "name": "Henry", "age": 34, "start": datetime(1900,1,1),        "end": datetime(2022,6,12,3,0,0)}
>>> {"id": 1, "name": "Henry", "age": 37, "start": datetime(2022,6,12,3,0,0), "end": datetimedatetime(2022,6,12,3,15,0)}
>>> {"id": 1, "name": "Henry", "age": 99, "start": datetime(2022,6,12,3,15,0),"end": datetime(2999,12,31)}
>>> {"id": 2, "name": "Fred",  "age": 42, "start": datetime(1900,1,1),        "end": datetime(2022,6,12,3,15,0)}
>>> {"id": 2, "name": "Fred",  "age": 99, "start": datetime(2022,6,12,3,15,0),"end": datetime(2999,12,31)}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

typetwo-1.0.28.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typetwo-1.0.28-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file typetwo-1.0.28.tar.gz.

File metadata

  • Download URL: typetwo-1.0.28.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for typetwo-1.0.28.tar.gz
Algorithm Hash digest
SHA256 c0224dd83d1503755e019f12d9350618589a6dcdae94d01f373c538dd54f6a3e
MD5 cbf9edee5d689955df834bf8ca288d00
BLAKE2b-256 2767e2adb08798fd7f05ff41e4ce299cb7ab5ec15007aa67c0712d73375f8c99

See more details on using hashes here.

File details

Details for the file typetwo-1.0.28-py3-none-any.whl.

File metadata

  • Download URL: typetwo-1.0.28-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for typetwo-1.0.28-py3-none-any.whl
Algorithm Hash digest
SHA256 50bd15410f42f927454ad7ef0eb0bba32bd7fdea5b7b61376b6eacc70f1fd53c
MD5 8e796a772e280653ce71ddaa0e4c7740
BLAKE2b-256 cbcc743f3c9694ab6170c9ca8081302d407c964164ecc74ba3b15b654b214be9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page