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

Uploaded Python 3

File details

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

File metadata

  • Download URL: typetwo-1.0.7.tar.gz
  • Upload date:
  • Size: 6.8 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.7.tar.gz
Algorithm Hash digest
SHA256 70d2f789929545f7011ba7be5dd36dc44e6d74c1bddd66ca7126c17994018595
MD5 1d4fa10fdfe4078e899b992c13b8de20
BLAKE2b-256 1289eb571262c41dafff29ebd4fd1821a3e75433c680726d5c4f3b91cb7cbeda

See more details on using hashes here.

File details

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

File metadata

  • Download URL: typetwo-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 7.7 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e092224f89eb80a1cd2caef4744cddefaa327d8269072c6ecfdc3d44a3fd4bf5
MD5 34279aa746087464948702bd5f5069a8
BLAKE2b-256 c7b19550fe668e41f498dc5d145ffdc981cc557ce27f4086920889145b38a74b

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