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.8.tar.gz (6.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.8-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typetwo-1.0.8.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for typetwo-1.0.8.tar.gz
Algorithm Hash digest
SHA256 8a03e4aa779739f1d86a09cf77261f644682b776631a715b2e267293bc8cf3dc
MD5 8cd58d25ff2db30c6a17727fb1d211b3
BLAKE2b-256 62c2963aad1f4123af13257d547fb0362be7a7a6431ccbb9deac8a34295fb1ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: typetwo-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for typetwo-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fe787ddf7be12e0fbc41abe7a4ecd23f9fc4f71713dbfc9beec0eda2a83cfb22
MD5 ab840c62cbb41154eb8a3f0f775210fe
BLAKE2b-256 775dfb10bf80825af16a6b31e8d3b4d006a325f4a97d39a195d92aeabdc8c544

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